What library can I use to connect to Oracle in Python?
I know that there is a cx_Oracle, but it does not work for me, it gives an error:

cx_Oracle.DatabaseError: DPI-1050: Oracle Client Library Version 11.2 or higher

import cx_Oracle conn = cx_Oracle('jdbc:oracle:thin:tst/tst@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = e-scan)(PORT = " \ "1521))(CONNECT_DATA " \ "=(SERVER = DEDICATED)(SERVICE_NAME = snm))))') 

Oracle Instant Client unpacked in (C: \ Oracle \ instantclient_12_2), registered in ORACLE_HOME, PATH.

  • Comments are not intended for extended discussion; conversation moved to chat . - Qwertiy

1 answer 1

Mistake:

cx_Oracle.DatabaseError: DPI-1050: Oracle Client Library Version 11.2 or higher

indicates that cx_Oracle trying to use an old (unsupported) version of Oracle [Instant] Client .


Requirements for cx_Oracle 6.x :

  • Python 2.7 or 3.4 and higher. Older versions of cx_Oracle may work with older versions of Python.
  • Oracle Client libraries . If you are a client of the Oracle Database, you can get it. Oracle client libraries versions 12.2 , 12.1 and 11.2 are supported on Linux, Windows and macOS. Users have also reported success with other platforms.
  • An Oracle Database. Oracle's standard client-server version interoperability allows cx_Oracle.

Python and cx_Oracle's platform ("bit depth") must match — either both 64-bit packages or both 32-bit packages.

Also, you need to write the appropriate path to the Oracle Client in the environment variables ORACLE_HOME and PATH .

For example, in the Windows Environment Variables dialog box:

 PATH: C:\Oracle\instantclient_12_2;... ORACLE_HOME: C:\Oracle\instantclient_12_2