Informix, pyodbc, Centos



我正在尝试通过 Informix 连接我的工作数据库以创建脚本,但我在连接中遇到了问题。

错误是:

 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)")

但实际上我在机器上有这个文件,所以我使用了ldd,发现真正的错误是找不到库libifgls.solibifglx.so

[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)

和我的/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

和我的/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

如何解决此问题才能正确连接?

我更新了 PATHS,所以我用 ldd 进行了双重检查,但问题是我得到了文件,但仍然是相同的错误:

[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)

当我安装 Informix 这个文件时,我实际上更改了/etc/ld.so.conf

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

最后我可以解决这个问题,错误是我在 Informix 上有一个旧版本,所以我安装了另一个版本,所以我的驱动程序可以工作,所以也许这对某人有帮助!

相关内容

  • 没有找到相关文章

最新更新