Last active
January 30, 2023 05:26
-
-
Save cjbj/524c3e1cedd6ac3935817e182d734b97 to your computer and use it in GitHub Desktop.
This file contains 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 getpass | |
import os | |
import traceback | |
import oracledb | |
un = '' | |
cs = '' | |
pw = getpass.getpass(f'Enter password for {un}: ') | |
try: | |
connection = oracledb.connect(user=un, password=pw, dsn=cs) | |
with connection.cursor() as cursor: | |
sql = """select systimestamp from dual""" | |
for r, in cursor.execute(sql): | |
print(r) | |
except oracledb.Error as e: | |
error, = e.args | |
print(error.message) | |
traceback.print_tb(e.__traceback__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment