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 (:

Answers


To run programs using ODBC to connect to Informix, you need the Informix ODBC driver installed (or, conceivably, the IBM Common Client driver instead). To get that driver, you need to install the ClientSDK or CSDK product, or its run-time equivalent, I-Connect, on your machine, and then configure the DSN correctly. The Informix SQL product (known as isql, because that's the main program name) does not use or (therefore) install an ODBC driver; it uses ESQL/C connectivity. (However, on second thoughts, you're referrring to the isql that comes with UnixODBC - not the Informix product.)

The ClientSDK is available without support at a purely nominal cost of $0.00. Support is more expensive. Ditto for I-Connect. On the RHS of the linked page, under 'Technical Details' is a link to 'Informix Downloads' from whence you can obtain CSDK.

You could also look at the various new editions of Informix (Informix Dynamic Server) that can be used, with some licencing limitations (read the licence carefully) for free, and those include CSDK in the bundle of software.


@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 (:


Need Your Help

Possible bad practice in Web API ViewModel pattern?

c# api web asp.net-mvc-viewmodel view-model-pattern

I'm currently implementing ViewModels within my WebApi by injecting a Model object into the constructor of my 'ViewModelProduct' Object, as shown:

Why does a character trail after the hyperlink tag by one space when coded in a specific way?

html hyperlink

The character used in this question examples is the period, it appears that all characters behave the same way. Why does the period trail after the hyperlink by one space character when coded like...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.