[Zope-DB] Re: Auto-reconnect in DCOracle2
Matthew T. Kromer
matt at zope.com
Wed Sep 24 11:26:17 EDT 2003
The DA is only going to know that the connection closed if it gets an
error sending a command :(
The DA's query method has a lot of try/except wrappers to try to boost
it around the connection dissapearing and then causing a reconnect to
take place.
Chris Withers wrote:
> 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
>
--
Matt Kromer
Zope Corporation http://www.zope.com/
More information about the Zope-DB
mailing list