Install the python-oracledb driver for Oracle Database
because the driver comes with both Thin and Thick modes.
Change the install command to the more generic
python3 -m pip install oracledb
Change the code to:
import oracledb
conn = oracledb.connect(user="admin", password="<my_adw_admin_password>", dsn="my_adw_medium", config_dir="/scratch/tls_wallet", wallet_location="/scratch/tls_wallet", wallet_password="***")
cr = conn.cursor()
r = cr.execute("SELECT 1 FROM DUAL")
print(r.fetchall())
[(1,)]
It's better to separate the credentials and not stuff them in the DSN.
Technically the config_dir param isn't needed if the users followed the instructions and set TNS_ADMIN. But users may miss that step, and it won't hurt to set it again.
to:
because the driver comes with both Thin and Thick modes.
Technically the
config_dir
param isn't needed if the users followed the instructions and set TNS_ADMIN. But users may miss that step, and it won't hurt to set it again.