0

I have install oracle express edition database in my local machine. I have one python script by which i am connecting to the local database. But, Right now all connection are non-secure. I don't know how to setup ssl in local database and how to connect to it securely from python script. I am using cx-Oracle pyhton library. Below is the code to connect to the local oracle database.

import cx_Oracle

port = 1521
database = "new_pdb"
username = "testuser"
password = "<password>"

dsn = cx_Oracle.makedsn(host, port, database)
conn_str = (f"{username}/{password}@(DESCRIPTION =(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)"
f"(HOST={host})(PORT={port})))(CONNECT_DATA = (SERVICE_NAME={database})))")
conn = cx_Oracle.connect(conn_str)
if conn is not None:
  print("Connection successful...")

Can someone please let me know the steps to configure ssl on local database and how to connect to it from python script?

Thanks in advance!!!

MT0
  • 143,790
  • 11
  • 59
  • 117
  • 1
    Does this answer your question? [How to make a cx\_oracle connection encrypted using ssl?](https://stackoverflow.com/questions/69675900/how-to-make-a-cx-oracle-connection-encrypted-using-ssl) – astentx Jun 23 '23 at 09:50
  • Or maybe this: [How to make a cx_oracle connection encrypted with TLS? Do I have to use Oracle Wallets?](https://stackoverflow.com/q/71829334/2778710) (though it has a link-only answer but from the person responsible for cx_Oracle) – astentx Jun 23 '23 at 09:52
  • I would encourage you to enable TLS, however you may find NNE simple to set up in the meantime, see the [cx_Oracle doc](https://cx-oracle.readthedocs.io/en/latest/user_guide/connection_handling.html#securely-encrypting-network-traffic-to-oracle-database). (Also, upgrade cx_Oracle - it has a new name now: [python-oracledb](https://cjones-oracle.medium.com/open-source-python-thin-driver-for-oracle-database-e82aac7ecf5a)). – Christopher Jones Jun 26 '23 at 02:47

0 Answers0