Sample build scripts and configurations for the unixODBC driver manager
The unixODBC driver manager is an open source ODBC driver manager for use on the Linux® and UNIX platforms. The unixODBC driver manager is supported for use with ODBC applications on supported Db2® platforms. There are several build scripts and configurations that you can use with 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 are properly installed and configured, you can contact the 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, you can:
- Purchase a service contract for technical support from Easysoft, a commercial sponsor of the unixODBC (http://www.easysoft.com) driver manager.
- Participate in any open source support channels at http://www.unixodbc.org.
Sample build scripts
The following examples 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 (other than the AIX platform)
#! /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 examples are sample user and system INI files for using the unixODBC driver manager.
User INI file (odbc.ini)
The odbc.ini file is in the bin subdirectory of the unixODBC driver manager installation path.[DEFAULT]
Driver = Db2
[SAMPLE]
DESCRIPTION = Connection to Db2
DRIVER = Db2
System INI file (odbcinst.ini)
The odbcinst.ini file is in the bin subdirectory of the unixODBC driver manager installation path. The Driver entry for each database section must point to the location where Db2 libraries are located.There are multiple library files that are associated with Db2 ODBC driver. You must
specify a Db2
library based on your application environment.
- For a 32-bit unixODBC driver manager on the AIX® platform, you must specify the libdb2.a library for the Driver entry.
- For a 32-bit unixODBC driver manager on the Linux and UNIX platform other than AIX, you must specify the libdb2.so library for the Driver entry.
- For a 64-bit unixODBC driver manager on the AIX platform, you must specify the db2o.o library for the Driver entry.
- For a 64-bit unixODBC driver manager on the Linux and UNIX platform other than AIX, you must specify the libdb2o.so library for the Driver entry.
The following sample system INI file has the ODBC trace enabled,
with the trace log file set to trc.log
.
[DEFAULT]
Description = Default Driver
Driver = /u/db2inst1/sqllib/lib/db2o.o
fileusage=1
dontdlclose=1
[Db2]
Description = Db2 Driver
Driver = /u/db2inst1/sqllib/lib/db2o.o
fileusage=1
dontdlclose=1
[ODBC]
Trace = yes
Tracefile = /u/user/trc.log
Note:
- If you encounter problems when closing the driver manager, such as during
SQLDisconnect()
, set the valuedontdlclose=1
in the odbcinst.ini file, as shown in the sample system INI file. - The 64-bit unixODBC driver manager version 2.3.0 and later treats the SQLHANDLE and SQLLEN value as 64-bits in length. The 64-bit unixODBC driver manager versions before the version 2.3.0 treats the SQLHANDLE value as 64-bit in length, but the SQLLEN value as 32-bit in length.
- For ODBC wrapper DSN-less connection mode, odbcinst.ini is required. The
entry name is defined as
following:
[MSSQLSERVER] Driver=INSTHOME/sqllib/federation/odbc/lib/FOsqls27.so [SYBASE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOase27.so [SYBASEIQ] Driver=INSTHOME/sqllib/federation/odbc/lib/FOsyiq27.so [ORACLE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOora27.so [INFORMIX] Driver=INSTHOME/sqllib/federation/odbc/lib/FOifcl27.so [HIVE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOhive27.so [IMPALA] Driver=INSTHOME/sqllib/federation/odbc/lib/FOimpala27.so [SPARK] Driver=INSTHOME/sqllib/federation/odbc/lib/FOspark28.so [MYSQL] Driver=INSTHOME/sqllib/federation/odbc/lib/FOmysql27.so [POSTGRE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOpsql27r.so [OPENEDGE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOoe27.so [GREENPLUM] Driver=INSTHOME/sqllib/federation/odbc/lib/FOgplm27.so [HAWQ] Driver=INSTHOME/sqllib/federation/odbc/lib/FOgplm27.so [MONGODB] Driver=INSTHOME/sqllib/federation/odbc/lib/FOmongo28.so [NETEZZA] Driver=INSTHOME/sqllib/federation/netezza/lib64/libnzodbc.so [SALESFORCE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOsfrc27.so [FORCE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOsfrc27.so [REDSHIFT] Driver=INSTHOME/sqllib/federation/odbc/lib/FOrsft27.so [AZURE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOsqls27.so [ORACLECLOUD] Driver=INSTHOME/sqllib/federation/odbc/lib/FOrnow27.so [DATABASE] Driver=INSTHOME/sqllib/federation/odbc/lib/FOsfrc27.so