Getting the ODBC driver from the Informix Client access or SDK working with unixODBC

1. Set the INFORMIXDIR environment variable to the root of your Informix installation, this document assumes /usr/local/informix. /opt/informix is quite common.

2. Define the "online" service in /etc/services (or your equivalent NSS repository).

3. Construct an sqlhosts file in $INFORMIXDIR/etc that defines all your database servers.

4. Make sure the Informix libraries are found by ld. These are located in $INFORMIXDIR/lib and its subdirectories (this includes at least "cli" and "esql"). This usually involved adding these directories to /etc/ld.so.conf and re-running the ldconfig utility as root.

5. Define the ODBCINI environment variable to point at your system wide odbc.ini. Something like: export ODBCINI=/etc/odbc.ini This will mess up the ability of users to define their own data sources, but it seems like ODBCINI is the only way to control where the Informix driver looks for it's configuration information.

6. Add the Informix driver to odbcinst.ini, with no stray white space between parameter names and their values.

[Informix]
Description=Informix IDS 2000
Driver=/usr/local/informix/lib/cli/libifcli.so
APILevel=1
ConnectFunctions=YYY
DriverODBCVer=03.00
FileUsage=0
SQLLevel=1
smProcessPerConnect=Y

7. Define you Informix DSNs in odbc.ini

[miecr]
Driver=Informix
Server=BARNET
Database=miecr
CLIENT_LOCALE=en_us.8859-1
DB_LOCALE=en_us.8859-1
TRANSLATIONDLL=/usr/local/informix/lib/esql/igo4a304.so

8. You should now (assuming you have permissions to connect to the database server, etc...) be able to "isql miecr".

If you get "Server %s is not listed as a dbserver name in sqlhosts" or anything similiar it is probably caused by stray white space in either the Informix driver definition in odbcinst.ini or the DSN entries in odbc.ini that use the Informix driver. The driver's parser seems to be very easily confused.

This document was originally supplied by Adam Williams, and converted to html by Nick Gorham, so any mistakes are probably down to me (Nick)