How to access ODBC databases ?

Timothy Madden terminatorul at gmail.com
Fri Sep 4 16:41:35 CEST 2009


Hello

I would like to use a database through ODCB in my python application. I 
have Slackware Linux, but I would not mind a portable solution, since 
python runs on both Unixes and Windows.

I would like a free/open-source solution and the python module for ODBC 
access that I have found is *pyodbc*, but the problem is it fails to 
connect to my database with an error like:

 >>> conn = pyodbc.connect('DRIVER={PostgreSQL 
Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverConnectW)')


Do you know what the problem is ? My database is working and I can 
connect with *psql -U pikantBlue*, and also my ODBC installation is 
working and I can connect with *isql pikantBlue*.

 From python I can also connect with the *pyodb* module, which is 
another module for ODBC access, but pyodb does not have query parameters 
and all
the functions in the DB api, it is only meant the be a simple way to 
acccess ODBC.

Do you know why my *pyodbc* module would not connect, when others will ?
Do you know other modules to use ODBC in python ?

Thank you
Timothy Madden



More information about the Python-list mailing list