[unixODBC-support] Issue in adding system DSN

Srinivasan tsrini_it at yahoo.co.in
Tue Nov 17 14:02:09 GMT 2009


Hi Nick,

Thanks for your reply.

Yes, I build the unixODBC package (unixODBC-2.2.15pre) myself in my system and the libs libodbcinst.a & libodbcinst.so are from the same build. FYI, I have included --enable-static=yes option during ./configure.

Also, I have already tried with some debug traces with the source. The method odbcinst_system_file_path() results the same values (ie., /usr/local/etc) in SQLConfigDataSourceWide() in SQLConfigDataSource.c for both libodbcinst.a & libodbcinst.so but not sure, how the result differs. Anyhow, I'll add some more debug prints and check.

The main reason of not using the .so file is to avoid the dependency of the .so file in the machine where the application is going to be deployed. Of course, we take care of the license text messages which needs to include the unixodbc link.

Regards,
Srini

--- On Tue, 17/11/09, Nick Gorham <nick.gorham at easysoft.com> wrote:

From: Nick Gorham <nick.gorham at easysoft.com>
Subject: Re: [unixODBC-support] Issue in adding system DSN
To: "Support for the unixODBC project" <unixodbc-support at mailman.unixodbc.org>
Date: Tuesday, 17 November, 2009, 6:07 PM

Srinivasan wrote:
> Hi,
> 
> I am trying to create system DSN in my C++ application (in linux) by linking 'libodbcinst.a' statically. Here is the syntax which I used to create the DSN,
> 
> SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "MySQL", "DSN=xxxxxx\0UID=xxxx\0PWD=xxxxx\0Description=xxxxxxx\0Database=xxxxxx\0Server=xxxx\0Port=xxxxxx\0\0");
> 
> While doing this, instead of creating the system DSN in /usr/local/etc/odbc.ini file, it creates user DSN in /root/.odbc.ini file (running my application as root user).
> 
> If the same code is linked with 'libodbcinst.so' file, it works & system DSN is created in /usr/local/etc/odbc.ini. Also, exporting the environment variable ODBCSYSINI in my application doesn't help.
> 
> Am I missing anything.
> 
> Regards,
> Srini
> 
> 
> ------------------------------------------------------------------------
Hard to say, are you sure the libodbcinst.a is from the same build? Did you build unixODBC yourself, if so, add some debugging printf's to see whats going on.

Any particular reason you can't just use the .so? You are opening a path of pain for yourself with future versions, and you will still need to include all the LGPL links and text with your app anyway.

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



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20091117/7d63633b/attachment.html>


More information about the unixODBC-support mailing list