Created
February 3, 2022 06:24
-
-
Save shadabshaukat/1ac6992d442e5b4a02908c5b766fe8c1 to your computer and use it in GitHub Desktop.
Connection to Autonomous Database using TLS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cx_Oracle | |
| ### Autonomous Database Loading Block ### | |
| username='ADMIN' | |
| pwd='*******' | |
| dsn_name="""(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.ap-sydney-1.oraclecloud.com))(connect_data=(service_name=******_low.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)(ssl_server_cert_dn="CN=adb.ap-sydney-1.oraclecloud.com, OU=Oracle ADB SYDNEY, O=Oracle Corporation, L=Redwood City, ST=California, C=US")))""" | |
| encoding_name="UTF-8" | |
| connection = cx_Oracle.connect(user=username,password=pwd,dsn=dsn_name,encoding=encoding_name) | |
| cur = connection.cursor() | |
| cur.execute("select sysdate from dual") | |
| res = cur.fetchall() | |
| for row in res: | |
| print(row) | |
| cur.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment