[unixODBC-dev] Building a single static unixODBC application + Postgres driver

Sebastian Wess sebastian_wess at ymail.com
Sat Jul 31 01:23:47 BST 2010

I need to distribute a single application binary to connect to Postgres (or other databses) using unixODBC with no external dependencies. Is it possible to use the unixODBC driver manager when the driver itself is statically linked into the executable? It seems like unixODBC makes use of dlopen() to dynamically link in the driver at runtime, and I don't see how to get around that.

To start I would like to get a version of isql built that statically links in the Postgres driver and see if I can use that to connect. I've tried building with "./configure --enable-drivers --enable-static --enable-shared=no && make" and then manually re-linking isql with the Postgres driver with "gcc -g -O2 -pthread -o isql isql.o  ../DriverManager/.libs/libodbc.a ../extras/.libs/libodbcextraslc.a ../Drivers/Postgre7.1/.libs/libodbcpsql.a -ldl -lpthread -pthread", but odbcinst.ini seems to still require that I list a separate file in the "Driver" setting.

Is what I'm trying to do even possible?

P.S. Unfortunately I can't just bypass unixODBC and use the Postgres driver directly due to project requirements.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-dev/attachments/20100730/c4365b20/attachment.html>

More information about the unixODBC-dev mailing list