[egenix-users] Problem with Python mxODBC

M.-A. Lemburg mal at egenix.com
Tue Jan 4 12:03:05 CET 2005


Maneesh Singh wrote:
> Hi,
>    I have successfully installed freetds & unixODBC
> and I am able to connect to the remote MS SQL Server
> 2000 database through tsql & isql from my Fedora Core
> 2 machine. I need to connect to the MS SQl DB through
> Python & hence went for mxODBC. I installed the RPM &
> later also tried the source with the same negative
> result:
> Traceback (most recent call last):
>   File "db3.py", line 4, in ?
>     import mx.ODBC.unixODBC
>   File
> "/usr/lib/python2.3/site-packages/mx/ODBC/unixODBC/__init__.py",
> line 8, in ?
>     from mxODBC import *
> ImportError: libiodbcinst.so.2: cannot open shared
> object file: No such file or directory
> ------------------------------------------
> 
> The code (db3.py) under test is as follows:
> 
> 
> #!/usr/bin/python2.3
> 
> import mx.ODBC.unixODBC
> 
> dsn="ps0196"
> 
> conn=mx.ODBC.unixODBC.Connect (dsn, "maneesh_singh",
> "newuser")
> 
> print "Content-Type: text/plain"
> print 
> 
> cursorhandle=conn.cursor()
> 
> print "MySQL Databse via mxODBC....\n"
> cursorhandle.execute("select * from tb_mis_team")
> 
> for i in cursorhandle.fetchall():
>     print i
> 
> print cursorhandle.fetchall()
> 
> for i in cursorhandle.fetchall():
>     print i
> ------------------------------------------
> [root at ps0778 unixODBC]# pwd
> /usr/lib/python2.3/site-packages/mx/ODBC/unixODBC
> 
> [root at ps0778 unixODBC]# ldd ./mxODBC.so
>         linux-gate.so.1 =>  (0x00399000)
>         libodbc.so.1 => /usr/lib/libodbc.so.1
> (0x00506000)
>         libpthread.so.0 => /lib/tls/libpthread.so.0
> (0x00111000)
>         libc.so.6 => /lib/tls/libc.so.6 (0x006e9000)
>         libiodbcinst.so.2 => not found
>         libdl.so.2 => /lib/libdl.so.2 (0x00db8000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2
> (0x0089d000)
> 
> ------------------------------------------
>  
>   I had earlier tried to install iODBC without
> success.  The library libiodbcinst.so.2 exists at
> /usr/local/lib. I need to use unixODBC and not iODBC.

You should remove the complete iODBC installation and
then recompile mxODBC from source.

It may also help to edit mxCOMMERCIAL.py and comment out
the iODBC section in that file.

> Why is it asking for iODBC libraries when unixODBC is
> present? Was I supposed to use setup.in file the
> source code folders to configure something? Please
> help!

It is likely that the linker was picking up libs that
belonged to iODBC rather than unixODBC.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 04 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2004-12-06: Released eGenix mx Extensions for Python 2.4

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list