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 | 

ODBC Programming

Configuring Connection String

When you are programming CUBRID ODBC, write the connection strings as follows:

Category

Example

Description

Driver

CUBRID  Driver

Driver name

UID

PUBLIC

User ID

PWD

xxx

Password

FETCH_SIZE

100

Fetch size

PORT

33000

The broker port number

SERVER

127.0.0.1

The IP address or the host name of a CUBRID broker server

DB_NAME

demodb

Database name

DESCRIPTION

cubrid_test

Description

CHARSET

utf-8

Character set

The following shows the result of using connection strings above.

"DRIVER=CUBRID Driver;UID=PUBLIC;PWD=xxx;FETCH_SIZE=100;PORT=33000;SERVER=127.0.0.1;DB_NAME=demodb;DESCRIPTION=cubrid_test;CHARSET=utf-8"

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 strings.
  • The database connection in thread-based programming must be used independently each other.
Using Object Identifiers (OIDs) and Collections

CUBRID ODBC driver is designed for relational DBMS so it does not support all characteristics of object-oriented DBMS. It is because CUBRID is an object-relational DBMS integrating relational and object-oriented data models.

Using OIDs

Because CUBRID ODBC driver regards an OID as a string (char(32)), you can use INSERT, UPDATE, and DELETE statements containing OIDs as follows. The OID string should be used with single quotes (''). In the example below, the domain of the member attribute is treated as an object (OID).

insert into foo(member) values('@12|34|56')

delete from foo where member = '@12|34|56'

update foo set age = age + 1 where member = '@12|34|56'

Using Collections

There are three types of collections which are SET, MULTISET, and SEQUENCE. Because CUBRID ODBC driver regards a collection as a string (longvarchar), you can obtain collections with commas separated within braces such as "{value_1, value_2, ... value_n}" in the SELECT statement.

Note If a string longer than defined max length is inserted (INSERT) or updated (UPDATE), the string will be truncated.

Note To get the latest information about ODBC driver, click http://www.cubrid.org/wiki_apis/entry/cubrid-odbc-driver.