[Zope-DB] Auto-reconnect in DCOracle2
Chris Withers
chris at simplistix.co.uk
Wed Sep 24 11:04:10 EDT 2003
Christian Theune wrote:
>>>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?
>
> Only the python database module can know that for sure.
And how would it know?
> Actually the
> ZRDB API doesn't require anything to be Python DB API compliant, so you
> can't count on that. Most DAs use _v_connected != None to indicate they
> (not the python modules) have a connection.
Indeed, but this doesn't actually tell me whether the connection works or not.
In this thread, the _v_connected will be not None, but the Oracle connection has
gone away and so the user sees unsightly error messages when a ZSQL method tries
to use the connection.
What I'm after is code that will cause the connection to silently re-connect if
this happens.
Anyone got any ideas?
cheers,
Chris
More information about the Zope-DB
mailing list