oracle / adb-free

Universal Permissive License v1.0
35 stars 4 forks source link

Updates & fixes for the README Python driver section #4

Closed cjbj closed 7 months ago

cjbj commented 8 months ago
  1. In the README, change

Python thin driver

Install thin driver in your Python 3 environment

to:

Python

Install the python-oracledb driver for Oracle Database

because the driver comes with both Thin and Thick modes.

  1. Change the install command to the more generic

python3 -m pip install oracledb

  1. 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.

aosingh commented 7 months ago

Documentation is updated for Python section