From: Mike C. F. <mcf...@ro...> - 2003-12-02 03:25:05
|
I'm working on making my dbapi wrapper capable of detecting a situation where the database has gone down while a connection is held. i.e. this sequence... c = driver.connect() <database goes down, (and comes back up again, though that's irrelevant here)> c.cursor.execute( x ) Now, what I would expect to be raised is: OperationalError Exception raised for errors that are related to the database's operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc. It must be a subclass of DatabaseError. whereas what *is* raised is: ProgrammingError: (SQLQuery) could not receive data from server: Software caused connection abort (0x00002745/10053) where ProgrammingError is supposed to be: ProgrammingError Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc. It must be a subclass of DatabaseError. Seems that it really should be an operational error, as the server going down doesn't really constitute a programmer-avoidable situation. Enjoy, Mike _______________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ |