--- /dev/null
+.. change::
+ :tags: bug, oracle
+ :tickets: 4182
+
+ Fixed bug in cx_Oracle disconnect detection, used by pre_ping and other
+ features, where an error could be raised as DatabaseError which includes a
+ numeric error code; previously we weren't checking in this case for a
+ disconnect code.
def is_disconnect(self, e, connection, cursor):
error, = e.args
- if isinstance(e, (
- self.dbapi.InterfaceError, self.dbapi.DatabaseError)):
- return "not connected" in str(e)
- elif hasattr(error, 'code'):
+ if isinstance(
+ e,
+ (self.dbapi.InterfaceError, self.dbapi.DatabaseError)
+ ) and "not connected" in str(e):
+ return True
+
+ if hasattr(error, 'code'):
# ORA-00028: your session has been killed
# ORA-03114: not connected to ORACLE
# ORA-03113: end-of-file on communication channel
with expect_warnings(
r"An exception has occurred during handling of a previous "
- r"exception. The previous exception is.*i_dont_exist",
+ r"exception. The previous exception "
+ r"is.*(?:i_dont_exist|does not exist)",
py2konly=True
):
with patch.object(conn.dialect, "do_rollback", boom) as patched:
@property
def ad_hoc_engines(self):
- return exclusions.skip_if(["oracle"])
+ return exclusions.open()
@property
def no_mssql_freetds(self):