How to setup Oracle Autonomous DB connection for python in Ubuntu

Following blog shows how can we setup the connections between Python and Oracle Autonomous DB

Python and Pandas to get datasets from Oracle Autonomous DB

Once your Oracle client is setup correctly, you can use following query to test out the connection

Please replace the query to the ones that suits you

import cx_Oracle

con = cx_Oracle.connect("USERNAME","PASSWORD","CONNECTION_SERVICE_FROM_WALLET")

print("Database version: ", con.version)

query= """
select * from EMP
"""
cur = con.cursor()
cur.execute(query)
res=cur.fetchall()
for row in res:
  print(row)