import oracledb import getpass dbuser = 'dbahero' dbconn = 'localhost:1521/PDBHERO' dbpwd = getpass.getpass(f'Informe a senha de conexão da base de dados: [{dbuser}@{dbconn}]: ') with oracledb.connect(user=dbuser, password=dbpwd, dsn=dbconn) as connection: with connection.cursor() as cursor: sql = """select 'Olá Mundo! DBAHero!' from dual""" for r in cursor.execute(sql): print(r)