PostgreSQL ODBC driver installation on Linux

After I installed PostgreSQL 9.3 on my Fedora 20 I soon realized that I need PostgreSQL ODBC as well, because I’ll be using Oracle DG4ODBC to connect to PostgreSQL cluster.

I could simply install PostgreSQL ODBC with yum:

$ sudo yum install postgresql-odbc 

…and this is perhaps the best option on a long run (in general I prefer using yum as much as possible, even if I sacrifice of not having the latest version of some software), but in this particular case I had a good reason to install the very last version from source.

First download the latest PostgreSQL ODBC driver from:
http://www.postgresql.org/ftp/odbc/versions/src/

$ wget http://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-09.03.0100.tar.gz
$ tar -xzvf psqlodbc-09.03.0100.tar.gz
$ ./configure --with-libpq=/usr/pgsql-9.3 --disable-openssl
$ make
$ sudo make install

Installation will end with the following instructions (excerpt):

Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

A quick check if libraries are indeed there:

$ ls -la /usr/local/lib
total 1960
drwxr-xr-x.  2 root root      44 Dec 29 16:08 .
drwxr-xr-x. 13 root root    4096 Dec 25 22:52 ..
-rwxr-xr-x.  1 root root     971 Dec 29 16:08 psqlodbcw.la
-rwxr-xr-x.  1 root root 1996735 Dec 29 16:08 psqlodbcw.so

Posted on 29.12.2013, in Linux, PostgreSQL, etc. and tagged . Bookmark the permalink. Comments Off on PostgreSQL ODBC driver installation on Linux.

Comments are closed.