#77 Access violation in odbc when DB is down

closed-out-of-date
nobody
None
5
2008-04-10
2007-04-24
Michael Foetsch
No

When a DB connection is opened using "odbc.odbc()", and the connection object is reused for several queries (which it usually is), an access violation might occur.

To reproduce:

* Open a connection

* Execute an SQL query

* Shut down the SQL database service

* Execute another SQL query using the same connection object

* A Python exception occurs, which is expected

* When the DB cursor is garbage collected (or when you invoke "close()" on it explicitly), Python crashes with an access violation within the ODBC DLL

(I tried using Win XP and SQL Server 2005)

In the patch, the access violation is caught using a __try/__except. This also allows "attemptReconnect()" to do its magic when the SQL service goes back up.

Discussion

  • based on build 210

     
    Attachments
  • Mark Hammond
    Mark Hammond
    2008-04-10

    • status: open --> closed-out-of-date
     
  • Mark Hammond
    Mark Hammond
    2008-04-10

    Logged In: YES
    user_id=14198
    Originator: NO

    Thanks - but a slightly different version of a similar patch was checked in r1.20 of odbc.cpp