Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

OLE DB Programming

Using Data Link Properties Dialog Box

In the [Data Link Properties] dialog box, you can check and configure various OLE DB providers provided by the Windows operating system that you are currently using.

If you have properly installed the CUBRID OLE DB Provider for Windows, "CUBRID OLE DB Provider" will be displayed in the provider list of the [Data Link Properties] dialog box as shown below.

api_oledb_programming_dialog_provider.png

If you click the [Next] button after selecting "CUBRID OLE DB Provider," the [Connection] tab will appear as shown below. Set the desired link properties in the [Connection] tab.

api_oledb_programming_dialog_connect.png

  • Data Source: Enter the name of the CUBRID database.
  • Location: Enter the IP address or host name of the server where the CUBRID broker is running.
  • User name: Enter the user name to be used for logon to the database server.
  • Password: Enter the password to be used for logon to the database server.

Set all values of connection properties and then click the [All] tab.

api_oledb_programming_dialog_all.png

You can check every value currently configured in the [All] tab; to edit the value within the tab, double-click the item you want to edit. Enter the desired value in the [Edit Property Value] dialog box and then click [OK]. The figure above shows an example which configures the value of [Port] to "31000," and the value of [Fetch Size] is "100."

You can check whether the connection is working properly by clicking the [Test Connection] button in the [Connection] tab after completing all configurations.

api_oledb_programming_dialog_test.png

Configuring Connection String

When you do programming on the CUBRID OLE DB Provider using ActiveX Data Objects (ADO) or ADO.NET, 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

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"

Remark
  • 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.
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.