[Zope-DB] Shared.DC.ZRDB.Connection bare try: except?

Chris Withers chrisw at nipltd.com
Sat Sep 20 11:03:29 EDT 2003


Chris Withers wrote:

> If you click the "Close Connection" button of a DCOracle 2 connection, 
> it doesn't actually close the connection. How come?

Well, at a guess, because of this:

     def manage_close_connection(self, REQUEST):
         " "
         try: self._v_database_connection.close()
         except: pass
         self._v_connected=''
         return self.manage_main(self, REQUEST)

So, if something dodgy happens when closing the connection, the error gets 
silently ignored...

Would anyone have any objections to me changing this to:

     def manage_close_connection(self, REQUEST):
         " "
         try: self._v_database_connection.close()
         except:
           LOG('Connection.py',
                ERROR,
                'Error closing database connection',
                error=exc_info())
         self._v_connected=''
         return self.manage_main(self, REQUEST)

If I do change it, any reason why I shouldn't change it on the 2.6, 2.7 and HEAD 
branches?

> On this last point, has anyone implemented something like an 
> 'auto-reconnect' feature for DCOracle 2 so that the user never sees the 
> DCOracle2 Error: (1012, 'ORA-01012: not logged on') message?

Hmmm, I'm guessing ZSQL methods call the DA/Connection object to get the 
database connection? Is there anything that can be done in 
Shared.DC.ZRDB.Connection.Connection.__call__ to do this re-connection if the 
connection is found to be disconnected?

What would be the best way to find out if the connection is disconnected?

cheers,

Chris




More information about the Zope-DB mailing list