Connecting Pycharm with an Oracle SQL Database? - Error: DPI-1047

Hey guys,

i would like to connect PyCharm with an Oracle SQL Database, which is on a remote computer. I have installed cx_Oracle version 8.0 and followed the following Tutorial: https://www.oracletutorial.com/python-oracle/connecting-to-oracle-database-in-python/

up to the point where i got the following error: "DPI-1047: "Cannot locate a 32-bit Oracle Client library: "C:\...\product\18.0.0\dbhomeXE\bin\oci.dll is not the correct architecture". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help"

I followed the link in the error and since my database is on a remote computer, I downloaded "Oracle Instant Client “Basic”". I unzipped the Instant Client, but i seem to have trouble installing this.

 

Can someone help me to this the right way, so that the above mentioned error goes away and i can access my database?

I would be eternally grateful.

 

1
1 comment
Avatar
Permanently deleted user

Problem solved:

i used this tutorial the set it all up:

http://www.interfaceware.com/manual/oracle_instant_client.html

 

and i used this to set the Oracle Client Directory:

https://cx-oracle.readthedocs.io/en/latest/user_guide/initialization.html#using-cx-oracle-init-oracle-client-to-set-the-oracle-client-directory

import cx_Oracle
import sys

try:
    cx_Oracle.init_oracle_client(lib_dir=r"C:\oracle\instantclient_19_6")
except Exception as err:
    print("Whoops!")
    print(err);
    sys.exit(1);
1

Please sign in to leave a comment.