0

I'm getting an error in IntelliJ IDEA when im using a thin connection from java to oracle.

My oracle database is in a server and I can ping the server but my code can't establish connection:

        Class.forName("oracle.jdbc.driver.OracleDriver");
        connection = DriverManager.getConnection("jdbc:oracle:thin:@server ip:1521:orcl","user","path");
        System.out.println("Oracle Registered...");

and error is:

java.sql.SQLRecoverableException: IO Error: Socket read timed out
oracle.net.ns.NetException: Socket read timed out
4
  • IntelliJ has nothing to do with this. It's just an IDE. I'll assume that you have something sensible in your URL to substitute for "server ip". That needs to be a URL or XXX.XXX.XXX.XXX IP address that your client can see. Commented Aug 22, 2016 at 12:34
  • @duffymo you are right. I deleted the tag Commented Aug 22, 2016 at 12:35
  • Is the server's firewall configured correctly? A quick Google search provides this page as a list of ports for Oracle products. docs.oracle.com/cd/B19306_01/install.102/b15660/app_port.htm Commented Aug 22, 2016 at 12:58
  • firewall is ok.i can ping server.server ip is 172:1:16:64 and i write @172:1:16:64 for server ip. Commented Aug 27, 2016 at 7:51

1 Answer 1

1

It is possible that the network is reachable but the operations take too much time.

Check if you can establish a connection using a standard db client like toad, sql server or squirrel.

If you can use the same paramters in java and it should work.

If you can't check if another process is using port 1521 on the server.

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

1 Comment

i have checked and port is free.how can i stablish standard connection?

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.