unixODBC – PostgreSQL and ODBC Access Under Non Windows Operating Systems

Iguana supports PostgreSQL on Unix/Linux platforms through ODBC. Iguana utilizes the shared library of an ODBC manager, which in turn utilizes the shared library of PostgreSQL’s ODBC driver.

If your installation of PostgreSQL does not include an ODBC driver, you may download psqlodbc, which is the official PostgreSQL ODBC driver. Furthermore, if you do not already have an ODBC driver manager, you may download unixODBC, which is a popular ODBC driver manager distributed under GPL and LGPL.

Although unixODBC includes a PostgreSQL ODBC driver, some features utilized by Iguana weren’t supported by the included driver. Therefore, it is recommended that the latest version of psqlodbc be installed. Additionally, please ensure that the odbc.ini file utilized by the ODBC driver manager is configured to link to psqlodbc and not to some other PostgreSQL ODBC driver.

Two environment variables need to be configured for proper ODBC support on Unix/Linux. The LD_LIBRARY_PATH (or the equivalent dynamic linker variable for your platform) will need to include the absolute path to the ODBC driver manager’s shared library. Also, unixODBC requires an ODBCSYSINI environment variable to point to the directory that contains the odbc.ini file.

The name of the shared object that Iguana is looking for will vary depending on the platform:

Platform Library name Dynamic Linker Env Variable
Windows odbc32.dll PATH (usually for Windows things just work with ODBC)
OS X libiodbc.dylib DYLD_LIBRARY_PATH
Linux and others libodbc.so LD_LIBRARY_PATH
A common problem with getting Iguana to see the UnixODBC support on a platform is the need to tweak the dynamic linker env variable and sometimes make a symbolic link to make an alias to the actual library name to the shared object library for ODBC. i.e. let’s say you were on a 64 bit Linux system which had a 64 bit unixODBC called libodbc.so.1 then you might need to do something like:
>cd /usr/lib64  
>ln -s libodbc.so.1 libodbc.so
That would create a symbolic link libodbc.so to the real library file which is called libodbc.so.1. This is very common type of problem in linux/unix administration.
When setting those environmental variables we highly recommend leveraging:
  1. The Environmental Variables Settings page to set these environmental variables, and
  2. The database settings page to see the location of the ODBC library that Iguana has managed to, or not managed to load.

A big motivation for those screens was to aid in diagnosing exactly these kinds of setup issues.

There are UnixODBC drivers for connecting to Microsoft SQL Server and Sybase databases. We have had customers successfully connect to Microsoft SQL Server using Iguana on Linux in this manner. If you need more information please contact us at support@interfaceware.com.

Leave a Reply