'How to connect to oracle database with both password and wallet?

I am using Oracle Client 18 Home 1 SQL Developer platform is Windows-10-10.0.18362-SP0 python version is 3.8.8

cx_Oracle version is 8.0.1 cx_Oracle client version is (18, 3, 0, 0, 0)

I want to connect to Oracle database using cx_Oracle. My Oracle database is using 2 factor authentication, one is username and password, another one is wallet. So after research, I did the code below:

import cx_Oracle
import os
    
os.environ.get('ORACLE_HOME')
os.environ.get('TNS_ADMIN')
    
conn = cx_Oracle.connect(user='user', password='password', dsn='database_name')

I got error: DatabaseError: ORA-28759: failure to open file

It works for my coworker but I don't know why it doesn't work for me. Any insight would be appreciated!



Solution 1:[1]

I am not using Python, but similar error trying sqlplus to the database.

  1. export TNS_ADMIN= -- like your did
  2. Inside the sqlnet.ora file in that directory, make sure that the DIRECTORY points to the right directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sumit S