Access to Informix Database: Informix ODBC Driver Installation

Informix ODBC Driver

To access a Informix Database via unixODBC you need a driver.

The Informix ODBC Driver is part of the Informix Client SDK.
You get it free after registration from https://www.ibm.com/software/.
I used a search engine for Informix Client SDK.
Download Informix Client SDK Developer Edition for Linux x86_64, 64-bit.
A time of writing this is Version 4.10.FC8DE, filename is clientsdk.4.10.FC8DE.LINUX.tar

Informix Client SDK Installation

Prerequisites

unixODBC should be installed first, see Unix ODBC Installation

Extract tar file to installation directory

I created a directory /opt/install/informix and copied the tar file to this directory

cd /opt/install/informix
tar xf clientsdk.4.10.FC8DE.LINUX.tar

In the directory doc/ you find the documenation.

Running the installer

If you have an X11 client you may run the installer in gui (graphical) mode, otherwise you can use console mode.
I used the user root.

# user root

# start in gui mode:
./installclientsdk -i gui
# start in console mode:
./installclientsdk -i console

You only need to install these Features:

  • Informix ODBC Driver
  • Global Language Support (GLS) West European and Americas

In this example as installation directory is set to the default value /opt/IBM/informix

Installation in gui mode

Screenshots

Configure Informix sqlhosts

The file /opt/IBM/informix/etc/sqlhosts contains a list of informix databases, more info you get from your Informix database admin and find in the file /opt/IBM/informix/etc/sqlhosts.std

# file /opt/IBM/informix/etc/sqlhosts
#
#    


ol_informix1210 onsoctcp myinformixserver.local 9889
    Values used in this example:

  • ol_informix1210
    is the informix DBSERVERNAME (not the name of the linux server where the database is running). You get this name from your Informix admin
  • onsoctcp
    is the protocol used. In some examples you find olsoctcp. These two are identical.
  • myinformixserver.local
    The network name of the server where your Informix database is running. As an alternative, you can specify the ip address here.
  • 9889
    is the port number used for informix

Configure unixODBC

Next step is to integrate the Informix ODBC Driver into unixODBC.

Configure dsn in odbc.ini

The file odbc.ini in usually located /usr/local/etc/odbc.ini, /etc/odbc.ini, /etc/unixODBC/odbc.ini.
If you have compiled unixODBC from source as described in the previous article, you will use /usr/local/etc/odbc.ini.

For each connection a datasource name dsn is configured in odbc.ini

; informixtestdsn is the datasource name (not case sensitive)
[informixtestdsn]
; driver: unixODBC will use the specified driver
Driver=/opt/IBM/informix/lib/cli/iclit09b.so
; database: name of database
Database=delphi
; servername: name from sqlhosts
Servername=ol_informix1210

Test the configured dsn

For testing you need to set these environment varibles:

export INFORMIXDIR=/opt/IBM/informix
export LD_LIBRARY_PATH=$INFORMIXDIR/lib/esql
export ODBCINI=/usr/local/etc/odbc.ini

The configured dsn can be tested with isql:
/usr/local/bin/isql (if your compiled unixODBC from source) or /usr/bin/isql (unixODBC installed as package)

$ echo "SELECT FIRST 1 DBINFO('dbname') FROM systables" | /usr/local/bin/isql informixtestdsn username password
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> +---------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                 |
+---------------------------------------------------------------------------------------------------------------------------------+
| delphi                                                                                                                          |
+---------------------------------------------------------------------------------------------------------------------------------+
SQLRowCount returns -1
1 rows fetched
SQL> $

Troubleshooting

Some typical errormessages

isql errormessageReason
[ISQL]ERROR: Could not SQLConnectuse isql -v to get a more detailed message
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specifiedWrong datasource in isql command
[unixODBC][Informix][Informix ODBC Driver][Informix]Database not found or no system permission.Wrong database name in file odbc.ini
[unixODBC][Informix][Informix ODBC Driver][Informix]Incorrect password or user username@oraserver.localdomain[oraserver] is not known on the database server.Wrong username or wrong password

Next Step

If the isql Test works, your are ready to configure the Oracle Gateway to ODBC and the Database Link in your Oracle Database: Configure Oracle Gateway for ODBC with Informix ODBC