Open matepalocska opened 4 days ago
@matepalocska Are you able to connect to this Database using SQL*Plus via this Instant Client?
@matepalocska Are you able to connect to this Database using SQL*Plus via this Instant Client?
Yes, I can connect and run queries with SQL*Plus.
@matepalocska We will try to internally replicate this issue and get back to you.
@matepalocska Can you try upgrading your python version to 3.12 and run this test case?
@sharadraju Seems like the python version upgrade helped.
My latest results are:
platform.platform: macOS-14.5-arm64-arm-64bit sys.maxsize > 232: True platform.python_version: 3.12.4 oracledb.version: 2.2.1 current machine is ARM64 ODPI [354498] 2024-06-27 11:32:20.218: ODPI-C 5.2.0 ODPI [354498] 2024-06-27 11:32:20.218: debugging messages initialized at level 64 ODPI [354498] 2024-06-27 11:32:20.218: Context Parameters: ODPI [354498] 2024-06-27 11:32:20.218: Oracle Client Lib Dir: /Users/matepalocska/instantclient_23_3_arm64 ODPI [354498] 2024-06-27 11:32:20.218: Oracle Client Config Dir: /Users/matepalocska/instantclient_23_3_arm64/network/admin ODPI [354498] 2024-06-27 11:32:20.218: Environment Variables: ODPI [354498] 2024-06-27 11:32:20.218: ORACLE_HOME => "/Users/matepalocska/instantclient_23_3_arm64" ODPI [354498] 2024-06-27 11:32:20.218: TNS_ADMIN => "/Users/matepalocska/instantclient_23_3_arm64/network/admin" ODPI [354498] 2024-06-27 11:32:20.219: load in parameter directory ODPI [354498] 2024-06-27 11:32:20.219: load in dir /Users/matepalocska/instantclient_23_3_arm64 ODPI [354498] 2024-06-27 11:32:20.219: load with name /Users/matepalocska/instantclient_23_3_arm64/libclntsh.dylib ODPI [354498] 2024-06-27 11:32:20.530: load by OS successful ODPI [354498] 2024-06-27 11:32:20.530: validating loaded library (datetime.datetime(2024, 6, 27, 4, 32, 22),)**
Thanks for the suggestion!
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.22.0.0.0
platform.platform: macOS-14.5-arm64-arm-64bit sys.maxsize > 2**32: True platform.python_version: 3.10.7 oracledb.version: 2.2.1
Is it an error or a hang or a crash? It's a "silent" crash. The python debugger flashes the Server[pid-2005] disconnected unexpectedly message, then disappears immediately. No other error message is shown.
What error(s) or behavior you are seeing? The execution unexpectedly exits when trying to connect to the database, with the correct credentials. I also have DPI_DEBUG_LEVEL set to 64. TNS_ADMIN and ORACLE_HOME environment variables are set accordingly. SQLPlus is installed, no issue there - the Instant Client should be OK. Note: When running the same code, but in a Rosetta emulated terminal (using the instantclient_19_8_x86_64, and the intel package of the same modules), the connection works as expected.
Does your application call init_oracle_client()?
Yes, calling init_oracle_client() - using thick mode (see point 7).
Printing versions
print("platform.platform:", platform.platform()) print("sys.maxsize > 232:", sys.maxsize > 232) print("platform.python_version:", platform.python_version()) print("oracledb.version:", oracledb.version)
Initialize the Oracle client library
if platform.machine() == 'arm64': print("current machine is ARM64") oracledb.init_oracle_client(lib_dir='/Users/matepalocska/instantclient_23_3_arm64') elif platform.machine() == 'x86_64': print("current machine is x86_64") oracledb.init_oracle_client(lib_dir='/Users/matepalocska/instantclient_19_8_x86_64') else: raise Exception("Unsupported platform")
Specify your Oracle database credentials and DSN
username = "username" password = "password" dsn = "service_name"
Connect to the Oracle database
try: with oracledb.connect(user=username, password=password, dsn=dsn) as connection: with connection.cursor() as cursor: sql = "SELECT sysdate FROM dual" cursor.execute(sql) for row in cursor: print(row) except oracledb.DatabaseError as e: print("Database error:", e) except Exception as e: print("Exception occurred:", e)