[Zope] Database connectors

Dieter Maurer dieter at handshake.de
Fri Nov 17 14:07:09 EST 2006


rieh25 wrote at 2006-11-16 12:12 -0800:
>
>I wanted to do it because for some reason, my oracle connector (DCOracle)
>keeps disconnecting, and so I thought maybe it would be possible to define a
>python method to periodically check on it and reconnect it if necessary.

Many DA catch the exceptions that result from a lost connection
and then reconnect automatically.

I have seen such code in the "DCOracle2" DA as well.


Note, that simply reconnecting and redoing the query is
conceptionally wrong. It may lead to only half committed transactions.
After the reconnect, an exception derived from
"ZODB.POSException.ConflictError" should be raised which causes
the ZPublisher to redo the complete transaction.



-- 
Dieter


More information about the Zope mailing list