Skip to end of metadata
Go to start of metadata

Overview


This document describes how to set up various development tools using the ODBC Driver in Altibase development in the Windows environment.

This document is based on Altibase version 6.5.1 and Windows 10.

The ODBC for Windows is provided only up to Altibase version 6.5.1, and not provided to Altibase version 7 or later.

Icon

For errors and improvements related to this document, please contact the technical support portal or technical support center.

Altibase ODBC Driver Configuration


Before the development, the ODBC Driver provided by Altibase must be installed. This can be downloaded from http://support.altibase.com/en/.

Downloading ODBC


Go to http://support.altibase.com/en/, then "Downloads" → "Products" to download Windows ODBC files for each version. (Supports up to Altibase version 6.5.1)

For older versions that are unable on the website, please contact support@altibase.com.

                                      

Installing ODBC Driver


When installing for the first time, download and install the WINDOWS CLIENT package.

Since there is no complicated process when installing the WINDOW CLIENT package, this document will not describe it separately.

When installing WINDOWS CLIENT, the ODBC installation screen appears as shown below.

ODBC settings in Control Panel


To register Altibase ODBC Driver, click “Start” → “Control Panel” → “Management Tools” → “ODBC Data Source (64-bit)” → “Add”.

After clicking "Add", select ALTIBASE_HDB_ODBC_64bit and click "Finish".

When the following DB connection setting screen appears, enter the setting value for the connection.

Items
Description
Example
DB NameDB_NAME created at the time of DB creationmydb
Host (name or IP)IP information where Altibase DB Server is located192.168.1.35
NLS_USEDB character setMS949
PasswordDB account passwordmanager
Port (default 20300)Altibase DB Server connection port information20300
UserAccount on DBsys
Windows DSN NameName that distinguishes it from other DSN namesSERVER1


If the user clicks the "Test Connection" button after entering each item, the user can check the connection to the Altibase Driver with ODBC Driver. (Altibase DB Server must be running.)

If this is properly set, the user can check the newly added ODBC items as follows.

ODBC Driver Development Guide


When connecting to the Altibase DB server with ODBC driver, separate source conversion is not required, and ODBC connection strings need to be changed in the connection part.

Compile and use appropriate heads (ex. windows.h, sql.h, sqlext.h, afxdb.h) and library (ex. odbc32.lib) that can integrate ODBC drivers required in WINDOWS.

ODBC connection string


In a program using the ODBC Driver, the connection string is used as follows.

The path marked in red is used as a keyword, and the part marked in blue can be used after changing the value according to the connection information of the Altibase DB Server to be connected and the ODBC version.

DRIVER=ALTIBASE_HDB_ODBC_64bit;user=sys;password=manager; Server=127.0.0.1;PORT=20300;NLS_USE=MS949;LongDataCompat=on
DriverAltibase Driver name checked in ODBC management tool
UserUser account on DB
PasswordDB account password
ServerIP information where Altibase DB Server is located.
PortAltibase DB Server connection port information
NLS_USEDB character set
LongDataCompatON / OFF (Set to ON when using large data such as BLOB)

Visual C++ example source


A simple connection example in Visual C++ is as follows.

Visual C++ example source

Visual C# example source


A simple connection example in Visual C++ is as follows.

Visual C# example source

Visual Basic example source


A simple connection example in Visual Basic is as follows. In the example below, it is implemented as a source that connects to a DB and gets the current date and time. (The same applies when using ADO objects).

Visual Basic example source

Considerations when using LOB


In the case of Altibase, if LOB data type is used, it can be used after changing the connection information to Non-AutoCommit.

If not, NULL for LOB data type is brought when retrieving, or the following error occurs when insert/update time.

With the following example of C# source, the user can see the process of inserting/selecting a BLOB data type into a table.

The example of BLOB insert is an example of changing the connection information to Non-AutoCommit and inserting data as described above while the DB is connected.

The used “blob” variable is declared as Byte[] type.

The example of BLOB select is an example that declares a Byte[] variable through a function called BINARY_LENGTH provided by Altibase to find out the length of a BLOB data type, saves data in the variable, and creates a file.

Example of BLOB insert
Example of BLOB select

 


  • No labels