CodexBloom - Programming Q&A Platform

OCI Autonomous Database Not Allowing Connection from Compute Instance in Different VCN

πŸ‘€ Views: 765 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-07
oci oracle cx_oracle Python

I'm updating my dependencies and I'm attempting to set up I'm trying to connect to an Autonomous Database in Oracle Cloud Infrastructure (OCI) from a Compute Instance that is located in a different Virtual Cloud Network (VCN)....... Despite configuring the proper security lists and enabling required ports, I'm still working with the behavior `ORA-28000: the account is locked`. I verified that the database connection string is correct and I'm using the correct credentials. Here’s the connection code I'm using in Python with the cx_Oracle library: ```python import cx_Oracle # Define the connection string dsn = cx_Oracle.makedsn('mydb_high', 1522, service_name='my_service') try: connection = cx_Oracle.connect(user='my_user', password='my_password', dsn=dsn) print('Connected successfully') except cx_Oracle.DatabaseError as e: behavior, = e.args print(f'Oracle behavior code: {behavior.code}') print(f'Oracle behavior message: {behavior.message}') ``` I went through the following checks: 1. The Compute Instance has been assigned an appropriate public IP. 2. Security rules in both the VCNs allow ingress traffic on port 1522. 3. I tried connecting from the database console using the same credentials, and it works without issues. 4. I ensured that my Autonomous Database is in `Dedicated` mode and that the connection uses the appropriate connection string format. 5. I also checked the IAM policies, and my user has the `CONNECT` privilege on the database. Despite checking these configurations, I still receive the account locked behavior when attempting to connect from the Compute Instance. Is there something specific that I might be missing in the VCN or network configuration that could lead to this scenario? Any help regarding this would be greatly appreciated. Any ideas what could be causing this? I'm on Ubuntu 20.04 using the latest version of Python. Could someone point me to the right documentation? I'm working with Python in a Docker container on macOS. I'd really appreciate any guidance on this.