oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
328 stars 66 forks source link

connect to Oracle from Macbook with M1 Max processor #182

Closed explorercpp closed 1 year ago

explorercpp commented 1 year ago
  1. What versions are you using? python 3.9.6.
  1. Is it an error or a hang or a crash? error
  2. What error(s) or behavior you are seeing? Tried to create a python script to connect to remote Oracle 19 server. instant client has no special build for MacOS with "silicon" processor, such as M1 Max.
line 5, in <module>
    oracledb.init_oracle_client()
  File "src/oracledb/impl/thick/utils.pyx", line 458, in oracledb.thick_impl.init_oracle_client
  File "src/oracledb/impl/thick/utils.pyx", line 482, in oracledb.thick_impl.init_oracle_client
  File "src/oracledb/impl/thick/utils.pyx", line 403, in oracledb.thick_impl._raise_from_info
oracledb.exceptions.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 0x0001): tried: 'libclntsh.dylib' (**mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')**), '/System/Volumes/Preboot/Cryptexes/OSlibclntsh.dylib' (no such file), '/usr/lib/libclntsh.dylib' (no such file, not in dyld cache), 'libclntsh.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/usr/local/lib/libclntsh.dylib' (no such file), '/usr/lib/libclntsh.dylib' (no such file, not in dyld cache)". See https://python-oracledb.readthedocs.io/en//latest/user_guide/initialization.html#setting-the-oracle-client-library-directory for help

Thin client did not connect with following error.

connection = oracledb.connect(dsn) File "/Users/xxxx/Library/Python/3.9/lib/python/site-packages/oracledb/connection.py", line 1008, in connect return conn_class(dsn=dsn, pool=pool, params=params, **kwargs) File "/Users/xxxx/Library/Python/3.9/lib/python/site-packages/oracledb/connection.py", line 130, in __init__ impl.connect(params_impl) File "src/oracledb/impl/thin/connection.pyx", line 314, in oracledb.thin_impl.ThinConnImpl.connect File "src/oracledb/impl/thin/connection.pyx", line 202, in oracledb.thin_impl.ThinConnImpl._connect_with_params File "src/oracledb/impl/thin/connection.pyx", line 173, in oracledb.thin_impl.ThinConnImpl._connect_with_description File "src/oracledb/impl/thin/connection.pyx", line 107, in oracledb.thin_impl.ThinConnImpl._connect_with_address File "/Users/xxxx/Library/Python/3.9/lib/python/site-packages/oracledb/errors.py", line 118, in _raise_err raise exc_type(_Error(message)) from cause oracledb.exceptions.OperationalError: DPY-6005: cannot connect to database. [Errno 8] nodename nor servname provided, or not known

<!-

Cut and paste text showing the command you ran. No screenshots.

Use a gist for long screen output and logs: see https://gist.github.com/

-->

  1. Does your application call init_oracle_client()? yes, and thin client no, I tried both versions from your doc portal