python-oracledb thin client returns DPY-6000

822 Views Asked by At

I'm trying to run a Python app packaged in a Docker container on an OCI Ampere node.

Environment:

  • base image: python:3.10.9-slim built using buildx for arm64
  • client library: oracledb==1.2.1
  • Docker version: 20.10.22, build 3a2c30b
  • Docker host OS: 5.4.17-2136.311.6.1.el8uek.aarch64

But the app is returning the following error when it's trying to connect to an Autonomous Transaction Processing DB using the thin client:

File "/app/utils/db_connection_managers/oracle_connection_manager.py", line 13, in __init__
    self.db_conn = oracledb.connect(
  File "/usr/local/lib/python3.10/site-packages/oracledb/connection.py", line 1013, in connect
    return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/oracledb/connection.py", line 135, in __init__
    impl.connect(params_impl)
  File "src/oracledb/impl/thin/connection.pyx", line 318, in oracledb.thin_impl.ThinConnImpl.connect
  File "src/oracledb/impl/thin/connection.pyx", line 206, in oracledb.thin_impl.ThinConnImpl._connect_with_params
  File "src/oracledb/impl/thin/connection.pyx", line 177, in oracledb.thin_impl.ThinConnImpl._connect_with_description
  File "src/oracledb/impl/thin/connection.pyx", line 105, in oracledb.thin_impl.ThinConnImpl._connect_with_address
  File "src/oracledb/impl/thin/connection.pyx", line 101, in oracledb.thin_impl.ThinConnImpl._connect_with_address
  File "src/oracledb/impl/thin/protocol.pyx", line 168, in oracledb.thin_impl.Protocol._connect_phase_one
  File "src/oracledb/impl/thin/protocol.pyx", line 344, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 323, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/messages.pyx", line 1676, in oracledb.thin_impl.ConnectMessage.process
  File "/usr/local/lib/python3.10/site-packages/oracledb/errors.py", line 111, in _raise_err
    raise exc_type(_Error(message)) from cause
oracledb.exceptions.OperationalError: DPY-6000: cannot connect to database. Listener refused connection. (Similar to ORA-12506)

which suggests that the client is able to make a connection to the database (i.e. there are no connection/networking issues) but the connection request is actively rejected by the server.

I'm running the same container on my Mac(Intel) using the same dockerfile (built for amd64, obviously) and the same connection details with no issues.

There's a hint to this behavior in the documentation, but I'm not sure how/why it would apply to my case. Specifically, how it would not cause an issue in the container that's running on my Intel Mac, but it is a factor when the arm64 container is running on the A1 node.

Am I overlooking something or trying to do something that's not supported via the spec?

1

There are 1 best solutions below

0
On

As Yasin B correctly pointed out, the issue was caused by the existing configuration of the ACL on the ATP instance, which did not include the A1 node's public IP address. After adjusting the ACL, the issue is resolved.