OLE DB Driver

OLE DB (Object Linking and Embedding, Database) is an API designed by Microsoft for accessing data from a variety of sources in a uniform manner so it can be used by all Microsoft platforms. It is a set of interfaces implemented using the Component Object Model (COM).

.NET Framework is a software framework for Microsoft Windows operating systems. It includes a large library and it supports several programming languages which allows language interoperability (each language can utilize code written in other languages). The .NET library is available to all programming languages that .NET supports. A data provider in the .NET Framework serves as a bridge between an application and a data source; a data provider is used to retrieve data from a data source and to reconcile changes to that data back to the data source.

CUBRID OLE DB driver is written based on CCI API so affected by CCI configurations such as CCI_DEFAULT_AUTOCOMMIT.

Note

  • If your CUBRID OLEDB driver version is 9.1.0.p1 or later, only one installation package is needed for both Windows 32 bit and 64 bit. Our new OLEDB installer supports CUBRID DB engine 8.4.1 or later.
  • If your CUBRID OLEDB Driver version is 9.1.0 or older, it may have a problem on 64 bit operating system.

Installing and Configuring OLE DB

CUBRID OLE DB Provider

Before you start developing applications with CUBRID, you will need the Provider driver (CUBRIDProvider.dll). You have two options to get the driver.

  • Installing the driver: Download the CUBRID OLE DB driver’s .exe file at the location http://ftp.cubrid.org/CUBRID_Drivers/OLEDB_Driver/ or http://www.cubrid.org/?mid=downloads&item=oledb_driver. From OLE DB driver 9.1.0.p1 version(available from CUBRID server 2008 R4.1), both of 32 bit and 64 bit driver are installed on one installation.

    ../_images/oledb_install.jpg
    • There are below files in the installed directory.
      • CUBRIDProvider32.dll
      • CUBRIDProvider64.dll
      • README.txt
      • uninstall.exe
  • Building from source code: If you want to change CUBRID OLED DB Data Provider Installer, you can build it for yourself by compiling the source code.

OLE DB Programming

Configuring Connection String

When you do programming with the CUBRID OLE DB Provider, you should write connection string as follows:

Item Example Description
Provider CUBRIDProvider Provider name
Data Source demodb Database name
Location 127.0.0.1 The IP address or host name of the CUBRID broker server
User ID PUBLIC User ID
Password xxx Password
Port 33000 The broker port number
Fetch Size 100 Fetch size
Charset utf-8 Character set
Autocommit Isolation Levels 4096 isolation level

A connection string using the example above is as follows:

"Provider=CUBRIDProvider;Data Source=demodb;Location=127.0.0.1;User ID=PUBLIC;Password=xxx;Port= 33000;Fetch Size=100;Charset=utf-8;Autocommit Isolation Levels=256;"

Note

  • Because a semi-colon (;) is used as a separator in URL string, it is not allowed to use a semi-colon as parts of a password (PWD) when specifying the password in connection string.
  • If a string longer than defined max length is inserted (INSERT) or updated (UPDATE), the string will be truncated.
  • The database connection in thread-based programming must be used independently each other.
  • In autocommit mode, the transaction is not committed if all results are not fetched after running the SELECT statement. Therefore, although in autocommit mode, you should end the transaction by executing COMMIT or ROLLBACK if some error occurs during fetching for the resultset.

Multi-Threaded Programming in .NET Environment

Additional considerations when you do programming with the CUBRID OLE DB Provider in the Microsoft .NET environment are as follows:

If you do multi-threaded programming using ADO.NET in the management environment, you need to change the value of the ApartmentState attribute of the Thread object to a ApartmentState.STA value because the CUBRID OLE DB Provider supports the Single Threaded Apartment (STA) attribute only.

Without any changes of given values, the default value of the attribute in the Thread object returns Unknown value, causing it to malfunction during multi-threaded programming.

Warning

All OLE DB objects are the Component Object Model. Of COM threading model, the CUBRID OLE DB Provider currently supports the apartment threading model only, which is available in every multi-threaded environment as well as .NET environment.

OLE DB API

For more information about OLE DB API, see Micorosoft OLE DB documentation at http://msdn.microsoft.com/en-us/library/ms722784%28vs.85%29.aspx .

For more information about CUBRID OLE DB, see http://ftp.cubrid.org/CUBRID_Docs/Drivers/OLEDB/.