Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle DB connection error with Python - cx_Oracle: cx_Oracle.DatabaseError: DPI-1047

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?

like image 753
AAA Avatar asked Dec 05 '25 19:12

AAA


1 Answers

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.

like image 139
furkanayd Avatar answered Dec 08 '25 08:12

furkanayd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!