Problem with Python module

Maneesh maneeshsingh82 at
Tue Jan 4 05:56:25 EST 2005

   I want to connect to a remote MS SQL Server 2000 database through
my Fedora Core 2 machine via Python scripts. I have successfully
installed freetds & unixODBC and can now connect to the desired DB
through tsql(freetds) & isql(unixODBC). I installed mxODBC (RPM &
source) to be able to connect to the DB via Python scripts without any

The code( under test is as follows:

import mx.ODBC.unixODBC


conn=mx.ODBC.unixODBC.Connect (dsn, "maneesh_singh", "newuser")

print "Content-Type: text/plain"


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

The output is as follows:
[root at ps0778 cgi-bin]# python
Traceback (most recent call last):
  File "", line 4, in ?
    import mx.ODBC.unixODBC
  File "/usr/lib/python2.3/site-packages/mx/ODBC/unixODBC/",
line 8, in ?
    from mxODBC import *
ImportError: cannot open shared object file: No
such file or directory

Additional info:
[root at ps0778 unixODBC]# pwd
[root at ps0778 unixODBC]# ldd ./ =>  (0x0070b000) => /usr/lib/ (0x00b26000) => /lib/tls/ (0x007ca000) => /lib/tls/ (0x00eaa000) => not found => /lib/ (0x006b2000)
        /lib/ => /lib/ (0x0089d000)

I want to use unixODBC and not iODBC, why is mxODBC looking for
iODBC's libraray? I had earlier tried to install iODBC,
unsuccessfully, hence shifted over to unixODBC. The missing iODBC
library exist in /usr/local/lib folder. Do I need to link the iODBC
library to mxODBC during installation? How? Configure in the
source setup?



More information about the Python-list mailing list