2

I'm trying to connect my work db via Informix to create a script but I have problems in the connection.

The error is:

 Traceback (most recent call last):
  File "./Test1.py", line 11, in <module>
    con = pyodbc.connect(constr, autocommit=False)
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/IBM/informix/lib/cli/iclit09b.so' : file not found (0) (SQLDriverConnectW)")

But actually I have this file on the machine, so I used ldd and found the real error is that the libraries libifgls.so and libifglx.so are not found:

[jordaz@localhost scripts]$ ldd /opt/IBM/informix/lib/cli/iclit09b.so
        linux-gate.so.1 =>  (0xf777f000)
        libifgls.so => not found
        libifglx.so => not found
        libpthread.so.0 => /lib/libpthread.so.0 (0xf75db000)
        libc.so.6 => /lib/libc.so.6 (0xf741d000)
        libm.so.6 => /lib/libm.so.6 (0xf73d9000)
        libdl.so.2 => /lib/libdl.so.2 (0xf73d4000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xf73a4000)
        /lib/ld-linux.so.2 (0xf7780000)
        libfreebl3.so => /lib/libfreebl3.so (0xf73a0000)

and my /etc/odbcinst.ini

[cms]
Description           = MySQL connection to 'Kkapd' database
Driver                = MySQL
Database              = cms
Server                = 10.177.3.100
Port                  = 50005
Socket                = /var/lib/mysql/mysql.sock

[Informix]
Description           =Informix Driver
Driver                =/opt/IBM/informix/lib/cli/iclit09b.so
APILevel              =1
ConnectFunctions      =YYY
DriverODBCVer         =03.00
FileUsage             =0
SQLLevel              =1
smProcessPerConnect   =Y

and my /etc/odbc.ini

[cms]
Description           = MySQL connection to 'Kkapd' database
Driver                = MySQL
Database              = cms
Server                = 10.177.3.100
Port                  = 50005
Socket                = /var/lib/mysql/mysql.sock

[Informix]
Description           =Informix Driver
Driver                =/opt/IBM/informix/lib/cli/iclit09b.so
APILevel              =1
ConnectFunctions      =YYY
DriverODBCVer         =03.00
FileUsage             =0
SQLLevel              =1
smProcessPerConnect   =Y

How can I fix this so that I can connect properly?

I updated the PATHS so I duobled checked with ldd but the problem is that i got the files but still the same error:

[informix@localhost scripts]$ ldd /opt/IBM/informix/lib/cli/iclis09b.so
        linux-gate.so.1 =>  (0xf7786000)
        libifgls.so => /opt/IBM/informix/lib/esql/libifgls.so (0xf75c1000)
        libifglx.so => /opt/IBM/informix/lib/esql/libifglx.so (0xf75bf000)
        libc.so.6 => /lib/libc.so.6 (0xf73f8000)
        libm.so.6 => /lib/libm.so.6 (0xf73b4000)
        libdl.so.2 => /lib/libdl.so.2 (0xf73af000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xf737f000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf7364000)
        /lib/ld-linux.so.2 (0xf7787000)
        libfreebl3.so => /lib/libfreebl3.so (0xf7360000)

I actually altered the /etc/ld.so.confwhen I installed Informix this the file:

include ld.so.conf.d/*.conf
/home/informix/lib/cli
/home/informix/lib/esql
/home/informix/lib
export INFORMIXDIR=/home/informix
export PATH=$INFORMIXDIR/bin:$PATH
export LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$LD_LIBRARY_PATH
export TERMCAP=$INFORMIXDIR/etc/termcap
export TERM=vt100
export DBDATE=DMY4/
export DBCENTURY=C
export DBEDIT=nano
export VISUAL=nano
export INFORMIXSERVER=cms_net
export ONCONFIG=onconfig.cms
export INFORMIXSQLHOSTS=/home/informix/etc/sqlhosts
export ODBCINI=/etc/odbc.ini
Urkidy
  • 97
  • 9
  • 1
    It looks like you need to set `LD_LIBRARY_PATH` or configure `/etc/ld.so.conf` so that `/opt/IBM/informix/lib` and perhaps `/opt/IBM/informix/lib/esql` are searched automatically for shared libraries, so that `libifgls.so` and `libifglx.so` are also found. Using `ldd` is a good technique for discovering what's not being found. You can double check with `ldd` after you've altered your configuration. – Jonathan Leffler Mar 21 '17 at 22:09
  • How are you setting `LD_LIBRARY_PATH`, or did you alter `/etc/ld.so.conf`? I don't know whether [Changing LD_LIBRARY_PATH at runtime for ctypes](https://stackoverflow.com/questions/856116/changing-ld-library-path-at-runtime-for-ctypes) gives any insight. – Jonathan Leffler Mar 22 '17 at 15:41
  • @JonathanLeffler I added a copy of my file, I think its correct – Urkidy Mar 22 '17 at 22:57

1 Answers1

0

Finally I can solve this problem, the error was I had a old version on Informix so I re installed another version so my drivers can work, so maybe this can help to someone!

Urkidy
  • 97
  • 9