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

Sebastian Wess sebastian_wess at ymail.com
Sat Jul 31 02:41:24 BST 2010


Nick-

> Well, my first suggestion would be to bipass the driver manager, 
> what 
are the project requirements that prevent that?

The requirement is that I will eventually need to be able to ship the binary with multiple drivers (Postgres and MySQL) and use the ODBC interface to talk to both of them. So am I correct in understanding that this is going to be a non-starter without some code modification of the driver manager? I.e., there's no magic configure flag that will let me have everything bundled in one big executable?


--- On Sat, 7/31/10, Nick Gorham <nick at lurcher.org> wrote:

From: Nick Gorham <nick at lurcher.org>
Subject: Re: [unixODBC-dev] Building a single static unixODBC application + Postgres driver
To: "Development issues and topics for unixODBC" <unixodbc-dev at mailman.unixodbc.org>
Date: Saturday, July 31, 2010, 1:11 AM

Sebastian Wess wrote:
> 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.
> 
> 
Well, my first suggestion would be to bipass the driver manager, what are the project requirements that prevent that? Without dynamic loading you are going to have problems with name collisions if you try and use the driver manager and a driver without run time linking.

You do have the code so you could make changes, though be aware you need to comply with the terms of the LGPL if you distribute the result and make the changes available.

-- Nick
_______________________________________________
unixODBC-dev mailing list
unixODBC-dev at mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev



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


More information about the unixODBC-dev mailing list