DB2 Version 9.7 for Linux, UNIX, and Windows

Sample build scripts and configurations for the unixODBC 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. This topic presents some examples of possible build scripts and configurations you might want to use when using the unixODBC Driver Manager.

Support statement

If you experience problems with the combination of the unixODBC Driver Manager and the DB2 ODBC driver after they have been properly installed and configured, you can contact DB2 Service (http://www.ibm.com/software/data/db2/udb/support) for assistance in diagnosing the problem. If the source of the problem lies with the unixODBC Driver Manager, then you can:

Sample build scripts

The following are sample build scripts for setting up your environment to use the unixODBC Driver Manager.

AIX®

#! /bin/sh

echo "Unzipping and extracting"
gzip -d unixODBC-2.2.11.tar.gz
tar xf unixODBC-2.2.11.tar

cd unixODBC-2.2.11

#Comment this out if not AIX
export CC=xlc_r
export CCC=xlC_r

echo "Configuring, compiling and installing"
configure --prefix=$HOME --enable-gui=no --enable-drivers=no
make
make install

echo "Setting ini env vars."
export ODBCHOME=~/etc
export ODBCINI=~/odbc.ini

#Comment this out if not AIX
echo "Extracting unixODBC libraries"
cd ~/lib
ar -x libodbc.a
ar -x libodbcinst.a
ar -x libodbccr.a

echo "\n***Still need to set up your ini files"

UNIX (non-AIX)

#! /bin/sh

echo "Unzipping and extracting"
gzip -d unixODBC-2.2.11.tar.gz
tar xf unixODBC-2.2.11.tar

cd unixODBC-2.2.11

echo "Configuring, compiling and installing"
configure --prefix=$HOME --enable-gui=no --enable-drivers=no
make
make install

echo "Setting ini env vars."
export ODBCHOME=~/etc
export ODBCINI=~/odbc.ini

echo "\n***Still need to set up your ini files"

Sample INI file configurations

The following are sample user and system INI files for using the unixODBC Driver Manager.

User INI file (odbc.ini)

[DEFAULT]
Driver = DB2

[SAMPLE]
DESCRIPTION = Connection to DB2
DRIVER = DB2

System INI file (odbcinst.ini)

[DEFAULT]
Description = Default Driver
Driver = /u/db2inst1/sqllib/lib/db2.o
fileusage=1
dontdlclose=1

[DB2]
Description = DB2 Driver
Driver = /u/db2inst1/sqllib/lib/db2.o
fileusage=1
dontdlclose=1

[ODBC]
Trace = yes
Tracefile = /u/user/trc.log

This system INI file has the ODBC trace enabled, with the trace log file set to trc.log.

Note: If you encounter problems when closing the driver manager (such as during SQLDisconnect()), set the value dontdlclose=1 in the odbcinst.ini file, as shown in the example above.