Medardas
Medardas

Reputation: 540

Tnsnames not found in python even thou its set in env variables on win

I have a seemingly simple issue. When trying to connect to oracle database with python script it throws me this error:

cx_Oracle.DatabaseError: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

The thing is that tnsnames.ora is set in TNS_ADMIN environmental variable (im working on win 10) and I can even find it via sqldeveloper when creating new connections. Furthermore, Im sure im using correct dsn in my script ... hence... any ideas?

Upvotes: 0

Views: 519

Answers (1)

user2085801
user2085801

Reputation: 36

This is my code. Hope it helps

self.mydsn = cx_Oracle.makedsn(self.parser.get(
    'oracle', 'db'),
    self.parser.get('oracle', 'port'),
    self.parser.get('oracle', 'service_name')
    )

Upvotes: 2

Related Questions