# Import the library needed
import cx_Oracle
# Import config parser to read the .ini file setup as a secret
import configparser
# Setup the credentials
config = configparser.ConfigParser()
config.read('/var/run/secrets/user_credentials/oracle_credentials')
# Define some variables read from secret that was defined as an .ini file
username = config.get('default', 'username')
password = config.get('default', 'password')
uri = config.get('default', 'uri')
port = config.get('default', 'port')
db_name = <YOUR-DB-NAME>
# Create the connection and setup the cursor
conn = cx_Oracle.connect(f'{username}/{password}@//{uri}:{port}/{db_name}')
cur = conn.cursor()
# Example select statement and print for all results
# cur.execute("SELECT 'Hello World!' FROM dual")
# res = cur.fetchall()
# Print results
# print(res)
# Close the connection
conn.close()