Error oracledb DPI-047 on connection to oracle database

515 views Asked by At

I have an error when I try to connect to an Oracle database in version 10. I use oracledb as a module. The error :

oracledb.init_oracle_client(lib_dir="64Bit121")
  File "src\oracledb\impl/thick/utils.pyx", line 455, in oracledb.thick_impl.init_oracle_client
  File "src\oracledb\impl/thick/utils.pyx", line 479, in oracledb.thick_impl.init_oracle_client
  File "src\oracledb\impl/thick/utils.pyx", line 400, in oracledb.thick_impl._raise_from_info
oracledb.exceptions.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found"

And the code :

import oracledb

oracledb.init_oracle_client(lib_dir="64Bit121")
with oracledb.connect(user="etusae1",password="***",host="162.38.222.149", port=1521, sid="iut") as connection:
    with connection.cursor() as cursor:
        sql = """select sysdate from dual"""
        for r in cursor.execute(sql) :
            print(r)

I tried several different clients (version 11.2 in 64 and 32 and also version 12.1 in 64bit) After hours of research I still do not understand why I have this error (I obviously hide my password and my login)

1

There are 1 answers

2
Anthony Tuininga On

First, have you tried with thin mode? Just comment out the line that calls init_oracle_client() and try again.

Second, if you need thick mode, the value supplied to init_oracle_client() for the lib_dir parameter should be an absolute path. Try changing that. You can also follow the documentation and set the environment variable DPI_DEBUG_LEVEL to the value 64 to see what is happening.