ORA-00028 is disconnect code

Issue #2200 resolved
Former user created an issue

Hi there!

After killing oracle session from SQLDeveloper I got

(DatabaseError) ORA-00028: your session has been killed

As I see here sqlalchemy doesn't recognize this as a disconnect error.

In addition, according to cx_Oracle documentation:

With cx_Oracle every exception object has exactly one argument in the args tuple. This argument is a cx_Oracle._Error

_Error has code attribute, so we could use it like this

def is_disconnect(self, e, connection, cursor):
    error, = e.args
    if isinstance(e, self.dbapi.InterfaceError):
        return "not connected" in str(e)
    else:
        # ORA-00028: your session has been killed
        # ORA-03114: not connected to ORACLE
        # ORA-03113: end-of-file on communication channel
        return error.code in [3114, 3113](28,)

Comments (4)

  1. Mike Bayer repo owner
    • changed milestone to 0.6.9

    Replying to guest:

    Hi there!

    After killing oracle session from SQLDeveloper I got {{{ (DatabaseError) ORA-00028: your session has been killed }}} As I see here sqlalchemy doesn't recognize this as a disconnect error.

    that's fine

    In addition, according to cx_Oracle documentation:

    With cx_Oracle every exception object has exactly one argument in the args tuple. This argument is a cx_Oracle._Error

    It's possible cx_oracle 4 didn't have this value. The "ORA-" code formatting comes straight from OCI which is far less likely to change than cx_oracle, which has made some switches on us in the past, particularly that I need to access an underscore attribute to get at this particular attribute. The string approach seems simpler and safer to me.

  2. Log in to comment