Reputation: 499
Is it possible to have a reference file/document that houses a username & password when using a TNS with CX_Oracle?
The main reason for this is added security instead of saving the User ID (USER123) & Password (P455w0rd) into a python script.
The example below logs onto a Database & return the DB Version. Does anyone have an ideas on how to reference out the Username & Password?
import cx_Oracle
con = cx_Oracle.connect('USER123','P455w0rd','ORPM2')#TNSNAME.ORA
print con.version
con.close()
Upvotes: 1
Views: 2660
Reputation: 7096
You have a few options that I am aware of:
1) Use a secure password store (aka wallet)
2) Use operating system authentication
3) Use network authentication (e.g. Kerberos)
All of these are explained on the following page:
https://docs.oracle.com/database/121/DBSEG/authentication.htm#DBSEG99815
The first one is probably closest to what you have in mind but the others are also options that will solve the problem for you.
Upvotes: 1