From 28721572818507b84686139384902f1c08596b54 Mon Sep 17 00:00:00 2001 From: Sabron Date: Thu, 9 Jan 2025 16:15:30 +0700 Subject: [PATCH] update : 09.01.2025 16:15:30,23 --- start.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/start.py b/start.py index 2d2f6c8..d00d950 100644 --- a/start.py +++ b/start.py @@ -90,16 +90,20 @@ def start_ws(): def test_oracle_connect(): try: - import oracledb + import cx_Oracle un = 'mfsb' cs = '192.168.77.1:1521/v3' pw = '00QgSiB1' - with oracledb.connect(user=un, password=pw, dsn=cs) as connection: - with connection.cursor() as cursor: - print('connect') - #sql = """select sysdate from dual""" - #for r in cursor.execute(sql): - # print(r) + connection = cx_Oracle.connect(user=un, password=pw, + dsn=cs) + cursor = connection.cursor() + sql='SELECT * FROM MFSB.OBSTATE' + cursor.execute(sql) + for row in cursor: + print(row) + + cursor.close() + connection.close() except Exception as err: logging.error(traceback.format_exc())