Tech Tip: Setting up the UnixODBC driver manager and ODBC environment for DB2
Subbu Prabhu 060001JD9S Visits (6253)
An ODBC driver manager is not supplied on UNIX platforms as part of the operating system. Using ODBC on UNIX systems, therefore, requires a separate commercial or open source ODBC driver manager.
The unixODBC Driver Manager is an open source ODBC driver manager for use on UNIX platforms. This driver manager is supported for ODBC applications on supported DB2® platforms.
To run ODBC applications on Linux or UNIX operating systems, you must configure the UnixODBC Driver Manager.
Here are the steps to install and configure UnixODBC for ODBC applications connecting to DB2 database using IBM DB2 ODBC driver:
1) Download the latest unixODBC source code from here
2) Untar the source files.
gzip -d unix
3) For AIX® only: Configure the C compiler to be thread-enabled:
To compile a 64-bit version of the driver manager using the xlc_r compilers, set the environment variables OBJECT_MODE and CFLAGS:
4) Install the driver manager in either your home directory or the default /usr/local prefix:
(Home directory) Issue the following command in the directory where you untarred the source files:
Here is an example to install the UnixODBC driver manager in a DB2 instance home directory on a 32 bit Linux server:
Log in as the DB2 instance owner(example: db2v97) and run the following command from the directory where the UnixODBC source files are untarred:
./configure --prefix=$HOME --enable-gui=no --enable-drivers=no
5) Build and install the driver manager:
<The above steps will create the /lib, /include, /bin for the UnixODBC driver manager under DB2 instance home directory - /home/db2v97>
6) Add that path to the lib to LD_LIBRARY_PATH:
7) Create odbc.ini and odbcinst.ini as per the documentation: