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

After using the pyinstaller packager, an error message is reported when it is run #669

Open jiangtaobian opened 4 months ago

jiangtaobian commented 4 months ago
  1. What versions are you using? platform.platform: Windows-10-10.0.22631-SP0 sys.maxsize > 2**32: True platform.python_version: 3.9.13 cx_Oracle.version: 8.3.0 cx_Oracle.clientversion: (11, 2, 0, 4, 0)

    Packing command:pyinstaller.exe --add-binary='D:\instantclient_11_2*':. --onefile .\myscript.py

    Error information: Traceback (most recent call last): File "myscript.py", line 1, in ModuleNotFoundError: No module named 'cx_Oracle' [10136] Failed to execute script 'oadoc' due to unhandled exception!

    1. Include a runnable Python script that shows the problem.

    ''' import cx_Oracle hostname = 'my_hostname' port = 'port' service_name = 'service_name' username = 'username' password = 'password'

    conn = cx_Oracle.connect(f"{username}/{password}@{hostname}:{port}/{service_name}") print(conn)

    conn.close() '''

cjbj commented 4 months ago

Please upgrade to python-oracledb, and review https://github.com/oracle/python-oracledb/issues/31

jiangtaobian commented 4 months ago

noticed this message when I attemp to use python-oracledb: DPY-3010: connections to this database server version are not supported by python-oracledb in thin mode

Oracle Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

cjbj commented 4 months ago

python-oracledb has a Thick mode that is equivalent to cx_Oracle, and will connect to Oracle Database 11gR2, so you should upgrade to python-oracledb. You'll need to install Oracle Instant Client on the target machine, and add a call to init_oracle_client() to your code which will enable Thick mode and load Instant Client libraries.