3 Replies Latest reply on Oct 5, 2012 1:32 PM by 913779

    java.sql.SQLException: Socket read timed out


      // DbTest.java

      import java.sql.*;
      import java.io.*;

      public class DbTest
      public static void main(String args[])
      System.out.println("DbTest main(-)");
      Connection con = null;
      System.out.println("class loaded");
      con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcldb","scott","tiger");
      System.out.println("con obj created");

      System.out.println("con obj retrived");
      if (con!=null)
      System.out.println("Connection created successfully");

      System.out.println("Connection refused");
      catch (SQLException e)
      catch(Exception e)

      e:\JavaPrgms\JDBC>javac DbTest.java

      e:\JavaPrgms\JDBC>java DbTest
      DbTest main(-)
      class loaded
      java.sql.SQLException: Socket read timed out
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
      at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
      at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
      at java.sql.DriverManager.getConnection(DriverManager.java:582)
      at java.sql.DriverManager.getConnection(DriverManager.java:185)
      at DbTest.main(DbTest.java:17)
      Caused by: oracle.net.ns.NetException: Socket read timed out
      at oracle.net.ns.Packet.receive(Packet.java:320)
      at oracle.net.ns.NSProtocol.connect(NSProtocol.java:286)
      at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
      ... 7 more

      i am using win 7 64bit os , Oracle 11.2, Jdk 1.7 how can i resolve this problem?

      Edited by: 910776 on Oct 4, 2012 10:49 AM

        • 1. Re: java.sql.SQLException: Socket read timed out
          Your other thread got locked because all you did was post a bunch of code without explaining what your question or issue was or what the code is supposed to be doing.
          java.sql.SQLException: Socket read timed out

          Simply reposting in this forum isn't enough. Edit your post and and add \
           tags on the line before and the line after the code to preserve the formatting.
          Also explain what you are trying to do, the problem you are having and answer the questions I ask you in your other thread.
          What is it you are trying to do?
          Why are you trying to connect to two different databases?
          Do either of those databases actually exist?
          Do they exist on the local machine that Java is running on?
          Can you connect to either of them without using Java?
          • 2. Re: java.sql.SQLException: Socket read timed out
            @ O.P.,
            You also seemed to have abandoned this same connectivity question when you posted it eight months earlier.
            Re: java.sql.SQLException: The Network Adapter could not establish the connecti

            I suggest you make up your mind to actually work it through to completion for a change.
            • 3. Re: java.sql.SQLException: Socket read timed out
              8 months earlier error was diff now error is diff first check it and then tell me..

              So, here i want to create my java.sql.Connection object but socket is reading continuously i checked in both 10g and 11g both i am getting same problem. driver class is loading successfully but connection is not establishing.. i got this problem after intalling Windows 7 64bit with Oracle11.2g 64bit and Oracle 10.2 x64 , and same code i tried with mysql its working properly by only changing driver class name and url .. so tell me where is the problem?

              i checked in tnslistener.ora entry there

              my port no is "1521 " and my sid is :"orcldb" as well as my all the services related to oracle are also in starting mode i run oracle from my start>run > sqlplus> its working properly .. so i unable to identify the problem for establishing connection with oracle driver..

              Edited by: 910776 on Oct 5, 2012 6:30 AM