I have a python script which basically uses x_Oracle oracle client to connect to my database server and after connection I can run my SQL queries.
Now, as my db credentials have expired and I am forced to use kerberos auth which I have no idea about. Previously just doing the below code would work:
conn_str = u'username/password@dbx1.ct.com:1521/dbx1.ct.com'
conn = cx_Oracle.connect(conn_str)
c = conn.cursor()
c.execute(
"select DISTINCT ITEM_ID, UOM, from SMCFS93 where item = '" + item + "'")
for row in c:
print(row)
But now I need to use kinit to generate a ticket and I have a C:\kerberos\krb5.conf file and a C:\krb5cc_User file which I have given path location in SQL developer and then I can connect to my db server.
The method works fine if one wants to connect to DB using SQL developer but I am not able to get how to make this work in Python.
I tried creating a subprocess to enter kinit everytime and generate a ticket and tried few answers on stackoverflow but I can't connect to my db. Any suggestions on how to connect db server using kerberos will be of great help.