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
307 stars 59 forks source link

Connection fails with thin mode and SQLNET.ALLOW_WEAK_CRYPTO_CLIENTS=FALSE #296

Closed slords closed 4 months ago

slords commented 4 months ago
  1. What versions are you using?

oracle.se2: 19.21 platform.platform: macOS-14.3.1-arm64-arm-64bit sys.maxsize > 2**32: True platform.python_version: 3.11.7 oracledb.version: 2.0.1

  1. Is it an error or a hang or a crash?

Error when SQLNET.ALLOW_WEAK_CRYPTO_CLIENTS=FALSE. If this option is set to TRUE (the default) then the connection succeeds. Setting this to false enables stronger enforcement of encryption protocols. Normally setting this to FALSE requires 19.12 client libraries or newer (July 2021 or newer libraries).

  1. What error(s) or behavior you are seeing?

Traceback (most recent call last): File "src/oracledb/impl/thin/transport.pyx", line 300, in oracledb.thin_impl.Transport.read_packet ConnectionResetError: [Errno 54] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "", line 1, in File "/opt/homebrew/lib/python3.11/site-packages/oracledb/connection.py", line 1134, in connect return conn_class(dsn=dsn, pool=pool, params=params, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/oracledb/connection.py", line 523, in init impl.connect(params_impl) File "src/oracledb/impl/thin/connection.pyx", line 449, in oracledb.thin_impl.ThinConnImpl.connect File "src/oracledb/impl/thin/connection.pyx", line 445, in oracledb.thin_impl.ThinConnImpl.connect File "src/oracledb/impl/thin/connection.pyx", line 411, in oracledb.thin_impl.ThinConnImpl._connect_with_params File "src/oracledb/impl/thin/connection.pyx", line 392, in oracledb.thin_impl.ThinConnImpl._connect_with_description File "src/oracledb/impl/thin/connection.pyx", line 365, in oracledb.thin_impl.ThinConnImpl._connect_with_address File "src/oracledb/impl/thin/protocol.pyx", line 284, in oracledb.thin_impl.Protocol._connect_phase_two File "src/oracledb/impl/thin/protocol.pyx", line 386, in oracledb.thin_impl.Protocol._process_message File "src/oracledb/impl/thin/protocol.pyx", line 364, in oracledb.thin_impl.Protocol._process_message File "src/oracledb/impl/thin/protocol.pyx", line 436, in oracledb.thin_impl.Protocol._receive_packet File "src/oracledb/impl/thin/packet.pyx", line 588, in oracledb.thin_impl.ReadBuffer.wait_for_packets_sync File "src/oracledb/impl/thin/transport.pyx", line 302, in oracledb.thin_impl.Transport.read_packet File "/opt/homebrew/lib/python3.11/site-packages/oracledb/errors.py", line 162, in _raise_err raise exc_type(_Error(message)) from cause oracledb.exceptions.DatabaseError: DPY-4011: the database or network closed the connection [Errno 54] Connection reset by peer Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy-4011

  1. Does your application call init_oracle_client()?

No, there is no thick client for Mac M2 machines. I need to use the thin client.

  1. Include a runnable Python script that shows the problem.
import oracledb
connection = oracledb.connect(user='user', password='pass', dsn='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=service)))')
import oracledb
anthony-tuininga commented 4 months ago

This is a known restriction, unfortunately. See #94. It has been reported to management and I will report this request as well.