Tracing Odbc Calls for Informix Client for Linux

Tracing ODBC calls for Informix Client for Linux

I got ODBC trace with those settings in my odbc.ini:

[ODBC]
TRACE=1
TRACEFILE=/tmp/odbc_trace.txt
TRACEDLL=idmrs09a.so

I copied them from IBM Informix ODBC Driver Programmer’s Manual Version 3.50.
So other IBM documents seems not valid while those settings are in odbc.ini instead of odbcinst.ini and you must set TRACEDLL which was not mentioned in "Collecting data for an ODBC Problem" document.

UPDATE:
It seems IBM changed documentation: there is info on TRACEDLL, but odbcinst.ini remained.

Connecting to Informix DB from Linux - client SDK is installed

Before, just a comment. If you want to access Informix with PHP, exists a PDO for that... and you can found tips how install/configure it here, here or here PHP and Informix on Debian - how to install/configure the PDO

I use the "isql" command where I get it with unixODBC rpm (I use opensuse distro).

The official site : http://www.unixodbc.org/

There have some explanations how use it too.

The Informix manual you can found updated information : :http://pic.dhe.ibm.com/infocenter/informix/v121/topic/com.ibm.odbc.doc/ids_odbc_057.htm

To setup the Informix access I just:

  1. set the informix variables (you need the csdk installed)
export INFORMIXDIR=/opt/informix  
export INFORMIXSERVER=ifxtest
export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts
export PATH=$INFORMIXDIR/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools

  1. create the odbc.ini with the desire configuration.

    set the DNS name (is the Infdrv1 at the example)

    define the driver to path where is installed your csdk
    define the database, servername, login/passwd (if desire)
  2. export the ODBCINI variable pointing to your odbc.ini file , or create the $HOME/.odbc.ini for specific user.
  3. try connect to the database executing : isql <dns_name> <user> <passwd>

After all configuration above this is my test:

ifxdba1  cinacio@jdi:~
$ isql dba1 informix xxxxxx
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select first 1 * from systables;
+---------------------------------------------------------------------------------------------------------------------------------+---------------------------------+------------+------------+--------+-------+---------+-----------------------+-----------+------------+--------+----------+-----------------------+------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+--------------------------+------------+----------------+-----------+----------+
| tabname | owner | partnum | tabid | rowsize| ncols | nindexes| nrows | created | version | tabtype| locklevel| npused | fextsize | nextsize | flags | site | dbname | type_xid | am_id | pagesize | ustlowts | secpolicyid| protgranularity| statchange| statlevel|
+---------------------------------------------------------------------------------------------------------------------------------+---------------------------------+------------+------------+--------+-------+---------+-----------------------+-----------+------------+--------+----------+-----------------------+------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+--------------------------+------------+----------------+-----------+----------+
| systables | informix | 1048580 | 1 | 500 | 26 | 2 | 262 | 2013-06-05| 65539 | T | R | 21 | 16 | 16 | 0 | | | 0 | 0 | 2048 | 2013-06-05 21:28:50.00000| 0 | | | |
+---------------------------------------------------------------------------------------------------------------------------------+---------------------------------+------------+------------+--------+-------+---------+-----------------------+-----------+------------+--------+----------+-----------------------+------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+------------+------------+------------+--------------------------+------------+----------------+-----------+----------+
SQLRowCount returns -1
1 rows fetched
SQL>

Information of UnixODBC installed at my opensuse...

cinacio@jdi:~
$ rpm -qi unixODBC
Name : unixODBC
Version : 2.2.12
Release : 219.1.1
Architecture: x86_64
Install Date: Tue 15 Oct 2013 08:18:36 AM BRT
Group : Productivity/Databases/Tools
Size : 1700974
License : GPL-2.0+ ; LGPL-2.1+
Signature : RSA/SHA256, Sat 26 Jan 2013 01:57:06 PM BRST, Key ID b88b2fd43dbdc284
Source RPM : unixODBC-2.2.12-219.1.1.src.rpm
Build Date : Sat 26 Jan 2013 01:56:38 PM BRST
Build Host : build22
Relocations : (not relocatable)
Packager : http://bugs.opensuse.org
Vendor : openSUSE
URL : http://www.unixodbc.org/
Summary : ODBC driver manager with some drivers included
Description :
UnixODBC aims to provide a complete ODBC solution for the Linux
platform. Further drivers can be found at http://www.unixodbc.org/.

Authors:
--------
Peter Harvey <pharvey@codebydesigns.com>
Nick Gorham <nick@easysoft.com>
Distribution: openSUSE 12.3

Cannot Connect to informix through ODBC on linux machine

All the reference snippet you have mention is pointing to a direct usage of Informix ODBC driver, that is perfectly fine. I couldn't find any problem with the snippet that can lead to the error you are getting. At this moment I am bit puzzled about the error text snippet [unixODBC][Driver Manager]. I mean, the unixODBC Driver Manager should not come to picture when the application makes a direct reference to Informix ODBC driver. Can you please try LD_LIBRARY_PATH with the following value?

export LD_LIBRARY_PATH=${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${INFORMIXDIR}/lib/cli

FYI: Since you have created a DSN (with the INI file), you could just specify the DSN name in the connection string used by the PHP application, for example:

"DSN=informix_db; uid=xxx; pwd=xxxx;"

In case if you would like to try troubleshoot with a pure ODBC sample application connection (I mean outside of PHP environment), then here is the ODBC application sample code.
https://github.com/OpenInformix/ODBCExamples/blob/master/src/IfxOdbcSample1.c

https://github.com/OpenInformix/ODBCExamples/blob/master/src/odbc.ini

https://github.com/OpenInformix/ODBCExamples/blob/master/src/makefile

https://github.com/OpenInformix/ODBCExamples/blob/master/src/envc.bsh

Informix ODBC Connection Help

Here are the Informix ConnectionStrings on my favorite site for such references:

http://www.connectionstrings.com/informix

OleDb:

Provider=Ifxoledbc;Data Source=dbName@serverName;User ID=myUsername;Password=myPassword;

OleDb with security info in the connection string:

Provider=Ifxoledbc;Data Source=dbName@serverName;User ID=myUsername;Password=myPassword;Persist Security Info=true;


Related Topics



Leave a reply



Submit