Using unixODBC with Oracle 11g on Ubuntu 9.04

The current version of unixODBC (odbcinst1debian1 2.2.11-16build3) does not work with Oracle 11g on Ubuntu. When correctly setup it gives the following error (‘isql -v oracledb’):

isql: symbol lookup error: /opt/oracle/product/11.1.0/db_1/lib/libsqora.so.11.1: undefined symbol: SQLGetPrivateProfileStringW

To fix this, you need to install a newer version of the unixodbc libraries. Until the updated packages are available for Ubuntu, the easiest way to fix it is to download unixODBC from http://www.unixodbc.org and install it in /usr/local.

Extract the source archive:

tar zxvf unixODBC-2.2.14.tar.gz

cd unixODBC

By default, unixODBC will install into /usr/local which is what we want so that it doesn’t conflict with the existing packaged version. However, we also want it to use the config files in /etc instead of /usr/local/etc. Luckily, there is a configure option for this:

./configure –sysconfdir=/etc

Note that you need to install libqt4-dev in order to do the full build. However, you can use ‘–enable-gui=no’ if you don’t plan to use the gui (which is what I did).

sudo make install

Now it is compiled and installed. Make sure that /usr/local/lib is in your ld.so search path so that the dynamic linker picks up the new versions of the libraries. Since I had to add an entry for oracle anyway, I created a new file called /etc/ld.so.conf.d/oracle.conf  and inserted the following lines:

/opt/oracle/product/11.1.0/db_1/lib/

/usr/local/lib/

Save the file, and then run ‘sudo ldconfig’ to update the dynamic linker cache.

Now you should be good to go.

Leave a Reply

You must be logged in to post a comment.