pythonoracle-databasepython-oracledboracle-wallet

Oracle error using oracledb: ORA-28759: failure to open file


im trying to use oracledb to connect to the database from python, but i get the error:

ORA-28759: failure to open file

My code is the standard connection code:

import oracledb
oracledb.init_oracle_client(lib_dir=r"C:\oracle\instantclient_18_5")

dbadw = """###fromtnsnames"""


connx = oracledb.connect(user='my_user', password ='my_password',dsn=dbadw , encoding="UTF-8")

c= connx.cursor()

without initializing oracle_client the error im getting is:

DPY-6005: cannot connect to database (CONNECTION_ID=r+tcRVTAlqmL/bxaTd38UA==).
DPY-6000: Listener refused connection. (Similar to ORA-12506)

The user im using to connect to the database is not administrator but i checked that i can open and write files and write files in the wallet directory

Im using jupyter notebook

I also tried with cx_Oracle, but pip install cx_Oracle throws error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools" which i cannot install since im not admin. I checked many other posts on this same error but i didn´t get anywhere

Any other info i can give to solve this let me know Thanks in advance!


Solution

  • The error ORA-28759: failure to open file is generally due to the fact that your sqlnet.ora file doesn't have a valid value in its WALLET_LOCATION entry. This must be the directory in which the file cwallet.sso is found.

    The error DPY-6005 with the phrase Similar to ORA-12506 raised in thin mode is telling you a similar thing. In thin mode you must specify the location of the wallet in the wallet_location parameter. You also (by default) need to specify the wallet_password parameter.

    The documentation for connecting to Cloud databases should cover any remaining questions you might have!