Search code examples
c++informixdsnunixodbcisql

My C++ application cannot connect to Informix DB server


I've an application (can't provide code, as it's very long), that uses unixODBC. Also, I have installed isql. Everything seems to be configured correctly - drivers, servers and so on, as using isql, I connect to the Informix DB with no problems. But my application cannot connect, even when I'm using the same settings. The returned error is:

IM00 [unixODBC][Driver Manager]Data source name not found, and no default driver specified

So, here's the "interesting" part - I copied the odbc.ini file into ~/.odbc.ini and /etc/odbc.ini and then everything started working almost OK ("almost", as the app could connect to the one DSN, but not to the other, but it's still something).

Also :

[root@xxx xxx]# odbcinst -j
unixODBC 2.3.0
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /usr/local/etc/odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2
[root@xxx xxx]$ echo $ODBCINI
/usr/local/etc/odbc.ini
[root@xxx xxx]$ echo $INFORMIXDIR
/usr/informix

INFORMIXDIR is also correctly set. Nothing points to ~/.odbc.ini neither /etc/odbc.ini (actually, the second one helped, nothing to do with ~/.odbc.ini, just tried it (: )

odbc.ini are correctly configured, as isql works fine.

If you need any more info, please let me know. Thanks (:


Solution

  • @Jonathan Leffler - Yep, I have everything installed properly, the problem was definitely somewhere else. I'm answering here, as I found the solution (actually, a colleague of mine did). It was very, very stupid thing .. He just added /usr/local/lib in /etc/ld.so.conf and everything started normal.....

    Anyway, really thanks for your help (: