also note if you really want to prevent disconnects at the top of a transaction, you can use a pessimistic approach, see http://docs.sqlalchemy.org/en/rel_0_9/core/pooling.html?highlight=pessimistic#disconnect-handling-pessimistic .
On Dec 5, 2013, at 11:05 AM, Michael Bayer <[email protected]> wrote: > > On Dec 5, 2013, at 10:54 AM, Mariano Mara <[email protected]> wrote: > >> Hi there, in one application I am using sqlalchemy 0.7.8 against Oracle 11 >> release 1 and I am hitting Oracle's lost contact more times than I would >> like to. Since the app seems unable to recover from the error, I have to >> restart it completely (it is a pyramid app). >> According to this changeset[1], the error ORA-03135 (connection lost >> contact) is included in the expected disconnection errors from oracle since >> 0.7.5 and my expectation would be that sqlalchemy would be able to recover >> from such error gracefully. Did I misunderstand how it works? Should I take >> actions im my app when I somehow detects this situation? >> >> TIA, >> Mariano >> >> [1] >> http://www.sqlalchemy.org/trac/changeset/dfb0b6aa622006e1e71a5296c3fa17667e24aac1/ > > it will recover in that when you catch this exception, then continue to use > that Connection, it will know that it needs to reconnect with a fresh DBAPI > connection. the underlying connection pool is also dumped when this > exception is encountered. > > it’s not possible for the Connection to transparently retry the operation > with a new DBAPI connection without raising an error because connection > session state is lost. e.g. if it occurs in the middle of a result set, the > results are gone, occurs in the middle of a transaction, everything in the > transaction is gone, etc. > > > >
signature.asc
Description: Message signed with OpenPGP using GPGMail
