Problem with Python module

Discussion in 'Python' started by Maneesh, Jan 4, 2005.

  1. Maneesh

    Maneesh Guest

    Hi,
    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
    success.

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

    The output is as follows:
    ----------------------------------------------
    [root@ps0778 cgi-bin]# python db3.py
    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
    ----------------------------------------------

    Additional info:
    ----------------------------------------------
    [root@ps0778 unixODBC]# pwd
    /usr/lib/python2.3/site-packages/mx/ODBC/unixODBC
    [root@ps0778 unixODBC]# ldd ./mxODBC.so
    linux-gate.so.1 => (0x0070b000)
    libodbc.so.1 => /usr/lib/libodbc.so.1 (0x00b26000)
    libpthread.so.0 => /lib/tls/libpthread.so.0 (0x007ca000)
    libc.so.6 => /lib/tls/libc.so.6 (0x00eaa000)
    libiodbcinst.so.2 => not found
    libdl.so.2 => /lib/libdl.so.2 (0x006b2000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (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 setup.in in the
    source setup?


    Thanks!



    Maneesh.
     
    Maneesh, Jan 4, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Ortmann
    Replies:
    4
    Views:
    584
    Skip Montanaro
    Jul 2, 2003
  2. mathieu gontier
    Replies:
    1
    Views:
    327
    Alex Martelli
    Sep 1, 2004
  3. Mothra
    Replies:
    5
    Views:
    485
    Dennis Lee Bieber
    Apr 15, 2005
  4. Maric Michaud
    Replies:
    0
    Views:
    7,196
    Maric Michaud
    Jun 24, 2006
  5. Gabriel Genellina
    Replies:
    0
    Views:
    445
    Gabriel Genellina
    Nov 21, 2008
Loading...

Share This Page