[egenix-users] Problem with Python mxODBC, undefined symbol: SQLSetConfigMode

M.-A. Lemburg mal at egenix.com
Thu Nov 11 13:20:41 CET 2004


Maneesh Singh wrote:
> Hi,
> 
> I'm trying to connect to a Microsoft SQL Server 2000
> database through a Fedora Core 2 machine, using python
> 2.3.
> 
> I have tried using the mxODBC package from eGenix.
> 
> The code is as follows:
> 
> --------------------------------
> #!/usr/bin/python2.3
> 
> import mx.ODBC.iODBC
> 
> db =
> mx.ODBC.iODBC.DriverConnect('DSN=db_mis;UID=maneesh_singh;PWD=newuser')
> c = db.cursor()
> c.execute('select count(*) from tb_mis_team')
> c.fetchone()
> 
> c.tables(None,None,None,None)
> 
> mx.ODBC.print_resultset(c)
> c.close()
> db.close()
> --------------------------------
> 
> 
> This is the output that I get:
> 
> --------------------------------
> [root at ps0778 cgi-bin]# python db5.py
> Traceback (most recent call last):
>   File "db5.py", line 4, in ?
>     import mx.ODBC.iODBC
>   File
> "/usr/lib/python2.3/site-packages/mx/ODBC/iODBC/__init__.py",
> line 8, in ?
>     from mxODBC import *
> ImportError:
> /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so:
> undefined symbol: SQLSetConfigMode
> [root at ps0778 cgi-bin]#
> --------------------------------
> 
> 
> Could anyone tell me what could be the problem here? 

SQLSetConfigMode is not used in mxODBC, so this unresolved
symbol mut be coming from iODBC. Try ldd ./mxODBC.so
and see whether it acutally picks up the right version
of libiodbc (the one you compiled mxODBC against).

> I have installed eGenix's mxODBC from source, and if
> the installation is done through SRC RPM, then the
> error that we get is 
> 
> ImportError:
> /usr/lib/python2.3/site-packages/mx/ODBC/iODBC/mxODBC.so:
> undefined symbol: PyUnicodeUCS2_AsEncodedString

This is the standard UCS2 vs. UCS4 build problem:

Python can be compiled to
use UCS2 Unicode (2 bytes per Unicode code point) or UCS4
(4 bytes). Many current Unix  distributions choose UCS4
as the default since that's also what the glibc chose
as default.

You have to build mxODBC using the build version that your
Python installation uses.

> It like I install through this method then one
> problem, another method then another problem. I nee
> the above problems solved together.
> 
> 
> Thanks!

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Nov 11 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

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



More information about the egenix-users mailing list