ODBC driver for Linux

The ODBC client package works with Linux® as a 32-bit and 64-bit driver.

Downloading and configuring

Download the relevant Linux ODBC driver from the IBM® Data Server Driver Package.
64 bit

DSClients-linuxx64-dsdriver-...  
IBM Data Server Driver Package (Linux/x86-64 64 bit)
...
32-bit

DSClients-linuxia32-dsdriver-...
IBM Data Server Driver Package (Linux/x86-32 32 bit)
...
Extract the contents and navigate to the odbc_cli_driver directory. Then, select the 32-bit or 64-bit directory and extract the contents.

ODBC driver directory structure

The ODBC driver folder contains the following directories and files:
\bin
Contains the db2cli command.
..\lib
Contains the runtime library file.
..\include
Contains the header files that are used to compile client applications.
..\cfg
Contains the sample configuration files: db2cli.ini.sample and db2dsdriver.cfg.sample.

OpenSSL library configuration

The Linux operating system on your client node must have the OpenSSL (Open Secure Sockets Layer) RPM installed. The Db2 Big SQL driver communication layer depends on this OpenSSL library. To configure the OpenSSL library, you must be a root user and complete the following steps:
  1. To configure the OpenSSL library to support the 32-bit ODBC client:
    cd /lib
  2. Ensure that the libssl.so.<version> file exists by running the following command:
    ls -l  libssl.so.<version>
  3. If the file exists, create a soft link by running the following command:
    ln -s libssl.so.<version> libssl.so.6
  4. Ensure that the link is created by running the following command:
    ls -l libssl*
    The soft link is displayed as
    libssl.so.6 -> libssl.so.<version>

ODBC driver configuration

The configuration information for the ODBC driver is specified in the db2dsdriver.cfg file. For more information about the Data Server driver package, see Validating IBM Data Server Driver Package (Windows) installation.

Edit the db2dsdriver.cfg file to provide the required DSNalias and database information.

Client application configuration

A client application must provide the DSN name to the ODBC driver.

If the client application does not need to be compiled first, the name is provided in the external data source configuration of the client application. These applications generally contain user-friendly interfaces and can be configured by using the interface of the application.

If the client application must be compiled first, use one of the following ODBC application programming interfaces:
SQLConnect
SQLDriverConnect
These functions are useful for applications that have no user interface. In these cases, the application must reference the header file that is included in the following ODBC directory, /include
In order for a compiled application to access the ODBC driver, you must export your shared library path to include the ODBC driver library:
export LD_LIBRARY_PATH=<odbc/driver/lib/path>