Search code examples
oraclejdbcoracle-cloud-infrastructure-classic

Connect Oracle cloud Database using JDBC java


I have database username and password to access oracle db and also have service url like https://X-X.X.X.oraclecloudapps.com/apex/.

Can anybody know how to connect this db using JDBC connection.

I tried using oracle thin driver but somehow it failes. Sample java code:

Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@//X.X.X.X.oraclecloudapps.com:1521/sid", "username", "****");

It throws

Exception in thread "main" java.sql.SQLRecoverableException: Io exception: The Network Adapter could not establish the connection

I don't know SID here, it would be helpful if anybody give steps to find SID/ServiceName from Oracle Cloud dashboard.


Solution

  • There is only three way to connect Database Schema Service.

    • From an Oracle Application Express application running in Database Schema Service
    • From a Java application running in an Oracle Java Cloud Service
    • Through RESTful Web services