Python ODBC interface crash on connection failure to MS SQL

Mark Hammond mhammond at
Mon Apr 7 06:19:50 CEST 2003

Sophy wrote:

> Hi,
> I would appreciate ur advice on this problem that i am facing. 
> I am running a python application and using the MSSQL database through
> a python ODBC interface. I find that the python ODBC interface crashes
> whenever there is a connection failure to the MSSQL. I get an "unable
> to read memory" message coming up and a print message "disconnected"
> which i later found in the ODBC.cpp source file in the method
> odbcPrintError() which handles the dbi errors.
> I use the same with MySQL and dont seem to have any problems with
> connection failure handling.
> Can somebody advice me as to how i can resolve this issue.

That printf() is strange - but unfortunately may not be near the crash. 
     If you have no access to MSVC etc, you could try using 
win32api.Apply() to catch the win32 exception - not a great option though.

More information about the Python-list mailing list