0

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.

6
  • 1
    What did you do, exactly? What was the error message when it failed to connect? Please edit your question to provide an answer to these questions. Take the site tour and see the "help us to help you" blog, both at the bottom left of the page. Commented Jun 11, 2015 at 10:30
  • if this is the schema service, there's only access over REST and via the APEX Dashboard. If you're on our DBaaS, then you have to use SSH to access, so setup port forwarding on your jdbc connection to go through a SSH tunnel. Commented Jun 11, 2015 at 15:28
  • @Vérace, question edited please see it again. Commented Jun 12, 2015 at 13:10
  • @thatjeffsmith, How to check that this is a schema service or service is on DBaaS ? Commented Jun 12, 2015 at 13:13
  • To get SID i used query SELECT sys_context('USERENV', 'SID') FROM DUAL; but it gives every time different result, which is 4 digit integer. Commented Jun 15, 2015 at 5:13

3 Answers 3

3

You can't use JDBC to connect to the Database Schema Service. You can connect using the API or tools that utilize the REST API. For data upload to Oracle Database Schema Service, use Oracle SQL Developer, the Oracle Application Express SQL Workshop Data Upload Utility or the Oracle Application Express Data Load utility. Read more here: http://docs.oracle.com/cloud/latest/dbcs_schema/CSDBU/GUID-3B14CF7A-637B-4019-AAA7-A6DC5FF3D2AE.htm#CSDBU177

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

-2

Try the following JDBC URL to resolve the issue

"jdbc:oracle:thin:@host-address:1521/sid";

Note / is used after port and Not :

1 Comment

A URL that ends with /sid isn't valid. It's either :sid (which is deprecated) or /servicename.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.