[cx-oracle-users] How to transparently re-connect using cx_Oracle?
Brought to you by:
atuining
From: Laurelin of M. E. <la...@fn...> - 2006-09-28 14:58:39
|
Hello, Is it possible for a cx_Oracle.Connection to be told to "reconnect"? Here is the situation: We have written client code that uses cx_Oracle to call various pl/sql package methods. All cx_Oracle calls to the "real" database (callproc, callfunc, execute, fetchXXX, etc.) are wrapped in a RetryHandler object. The RetryHandler can recognize certain Well Known Situations and retry the call -- example is that somebody has recompiled (or is in the process of recompiling) the PL/SQL package and its associated underlying implementations. In this case, the RetryHandler recognizes the "existing state of packages has been discarded" exception, waits a bit, and retries. This works nicely. But the situation I'm facing now is: client establishes their cx_Oracle.Connection instance (and the assocated cx_Oracle.Cursor). Some time later, the database is "bounced", and that connection is no longer good. The RetryHandler recognizes the "not connected to Oracle" exception, but what to do with it? The RetryHandler has been given a cursor object (with its connection), and cannot "replace" that cursor/connection with a different instance. But it would be nice to tell that cursor/connection to "try to connect yourself again from scratch, as if you were new, but within the existing instance at the existing address". Is this possible? Or am I reaching for the moon? Thanks in advance, lauri -- lauri loebel carpenter computing grunt fermilab la...@fn... |