oracle / python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
https://oracle.github.io/python-cx_Oracle
Other
890 stars 361 forks source link

ORA-03113 on cx_Oracle.connect() #613

Closed Julexpuru closed 2 years ago

Julexpuru commented 2 years ago
  1. What versions are you using?

Database Info:

Server: Oracle Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.7.0 - Production

Driver: Oracle JDBC driver 11.2.0.4.0

platform.platform: Windows-10-10.0.19043-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.10.0

cx_Oracle.version: 8.3.0
cx_Oracle.clientversion: (21, 3, 0, 0, 0)
  1. Describe the problem

Tried to connect as stated in the quickstart section of the cx_Oracle Doc. As a result, generic

ORA-03113: end-of-file on communication channel
Process ID: 0
Session ID: 0 Serial number: 0

is given back.

We had the same issue when trying to connect to database in another client (DBeaver) untill we downgraded drivers from default 12.2 to 11.2. We're not sure how to do this with the cx_Oracle.init_oracle_connection() as "driver-name" parameter doesn't seem to refer actual Oracle Drivers.

We've tryed to install and init the Instant client version both directory-wise and PATH-wise with the same results.

On the other hand, when attempting to use any other instant client version we got:

ORA-03134: Connections to this server version are no longer supported.

even if stated in the cx_Oracle Docs that v8.2 has compatibility with IC v21, 19, 18, 12 and 11.2.

With only ORA-03113 given, we're still unsure where the problem comes from.

Thanks in advance.

  1. Include a runnable Python script that shows the problem.
import cx_Oracle as cxo

dsnstr ="""(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXXXX.XXXXXXX.XXXXX)(PORT=1551))(CONNECT_DATA=(GLOBAL_NAME=XXXXXXX.XXXXXX)(SID=XXXXXXXX)))"""

connection = None
try:
    connection = cxo.connect(
        user = "XXXXXXX",
        password = "XXXXXXX",
        dsn = "XXXXXXX.XXXXXX.XXXXX:1551/XXXXXX",
        encoding="UTF-8")

    # show the version of the Oracle Database
    print(connection.version)

except cxo.Error as error:
    print("C1")
    print(error)

connection2 = None
try:
    connection2 = cxo.connect(
        user = "SGPRADM",
        password = "admsgpr",
        dsn = dsnstr)

    # show the version of the Oracle Database
    print(connection2.version)
except cxo.Error as error:
    print("C2")
    print(error)
cjbj commented 2 years ago

The Oracle Client to Oracle Database interoperability matrix is summarized in the installation manual. The relevant bit for you is "Oracle Client 11.2 can connect to Oracle Database 9.2 or greater.", which is also what you found with DBeaver.

Review the initialization doc. On Windows you can choose to have the Oracle client library in PATH, or use init_oracle_client(lib_dir=...) as you seem to have found. But avoid using both methods if you have multiple Oracle Client versions on your system because that can lead to a clash. If you use init_oracle_client() then don't have different Oracle client libraries in PAATH.

The doc on init_oracle_client() shows that driver_name is just used for tracing, not for library use.

PS In case it's not obvious:

Oracle JDBC driver 11.2.0.4.0

cx_Oracle has nothing to do with Java or JDBC!

Julexpuru commented 2 years ago

Thx for the quick response.

Regarding the obvious reason, in my defense i shall say that i come from a Python stack and Java/Oracle dependencies get quite messy for me.

I'm writing back just to clear out (in case someone else look for this in the future) that I meant both directory and path-wise SEPARATELY. Meaning first trying one and then the other, in order to avoid the kind of clashes you mentioned (path issues are quite common in python installations and I'm aware of them).

Just to confirm, IC v11.2 works fine in the way stated in the doc chapter you mentioned earlier.

Thank you very much for the support!

cjbj commented 2 years ago

You problems could be solved if you upgraded the DB !! :)

Since you seem to have sorted it out, I'll close this.

Thank you for using cx_Oracle. Let us know if you have any other questions.