CodexBloom - Programming Q&A Platform

OCI Autonomous Database Connection Timeout with Java SDK on 19c Version

πŸ‘€ Views: 1 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-08
oracle java jdbc oci Java

I'm confused about I'm wondering if anyone has experience with I'm stuck on something that should probably be simple..... I'm relatively new to this, so bear with me... I'm experiencing a connection timeout scenario when trying to connect to an Oracle Cloud Infrastructure (OCI) Autonomous Database using the Java SDK. I'm using JDK 11 and the Oracle JDBC driver version 19.8.0.0.0. My connection string looks like this: ```java String jdbcUrl = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcps)(HOST=your-db-host)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=your-service-name)))"; Connection connection = DriverManager.getConnection(jdbcUrl, "your-username", "your-password"); ``` Despite this setup, I am receiving a timeout behavior after around 30 seconds. The behavior message is: ``` java.sql.SQLException: Io exception: The Network Adapter could not establish the connection ``` I have verified that the security list associated with the Autonomous Database allows access from my public IP. I've also double-checked the wallet file and ensured that it’s correctly configured. To troubleshoot further, I tried setting the connection properties to enable SSL and adjusted the `oracle.net.CONNECT_TIMEOUT` parameter: ```java Properties properties = new Properties(); properties.setProperty("oracle.net.CONNECT_TIMEOUT", "10000"); // 10 seconds timeout Connection connection = DriverManager.getConnection(jdbcUrl, properties); ``` This didn’t resolve the scenario, and I'm still getting the same timeout behavior. I've also attempted to connect using SQL Developer from the same network and was successful, which leads me to think the scenario might be with the Java SDK configuration or the way I’m constructing the JDBC URL. Any insights on what could be causing this timeout or how I can debug this scenario further would be greatly appreciated! Any ideas what could be causing this? I'm working with Java in a Docker container on macOS. What are your experiences with this? My development environment is Windows 10. Hoping someone can shed some light on this.