pythonoracle-databasetls1.2wallettls1.3

How to make a cx_oracle connection encrypted with TLS? Do I have to use Oracle Wallets?


Need to use cx_oracle module with python 3.x version to connect Oracle 19c with TLS. There are firewalls and proxies.

How to implement it? Do I have to use Oracle Wallets? Is TLS 1.2 good enough or I need TLS 1.3 in 2022?

import cx_Oracle
conn = cx_Oracle.connect("uname/pwd@//localhost:1521/sd")
cur = conn.cursor()
cur.execute("SELECT 'Hello' FROM dual")
res = cur.fetchall()

Solution

  • If this is a cloud DB you no longer always need a wallet. With recent Oracle Client libraries you can use 1-way TLS. See Easy wallet-less connections to Oracle Autonomous Databases in Python.