[unixODBC-support] Issue in adding system DSN

Nick Gorham nick.gorham at easysoft.com
Tue Nov 17 12:37:16 GMT 2009


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


More information about the unixODBC-support mailing list