2
votes

I am trying to use cx_Oracle (64bit python) to access my Oracle database. I followed the instruction here.

I installed cx_Oracle 7.2.3 and downloaded instantclient-basic-windows.x64-19.3.0.0.0dbru.zip with VC 2015-2019 (use the link provided in the page)

Actually, i have installed almost all versions of VC++

i added the Oracle Instant Client folder to my system environment variable, and I double checked it by typing 'PATH' in cmd.

However, when i run cx_Oracle.connect('xxx'), i still got an error saying,

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help

What could be possible reason for the error? How to fix it?

1
Did you run Python in the command prompt in which you typed the PATH command? You can check the value of PATH in Python itself by examining the value of os.environ["PATH"] - Anthony Tuininga
yes, i also added my Oracle Instant Client folder path as the first element in os.environ["PATH"], but still got the same error. - AAA
Check the output from depends.exe to confirm that everything can be found. The error is stating that OCI.dll or one of its dependencies cannot be found. - Anthony Tuininga
Thanks, Anthony. But may i know which depends.exe you are referring to? - AAA

1 Answers

2
votes

This error mainly occurs because of instantclient version and cx_Oracle not compatible. Solution is to replace the instantclient with the required version mentioned in the error message (in your case 64-Bit).

How to replace instantclient: Then if your problem continue, find the latest instantClient (Caution! version which your error refers not your Python/Windows version, in above case 64-bit) on Oracle Downloads, download and replace it with your current PATH on system variables or just replace new download with your current instantClient folder.

Also, checking on your VS redistributable version corresponding to your Oracle DB version is correct and installed as refereed in cx_oracle Docs is proposed method, but in many of our cases it didn't caused the problem.