// SelectTest.java import java.sql.*; public class SelectTest { public static void main(String args[]) throws Exception { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger"); if (con == null) { System.out.println("Con not established.."); } else System.out.println("Conn established..."); } }
e:\JavaPrgms\JDBC>javac SelectTest.java
e:\JavaPrgms\JDBC>java SelectTest
Exception in thread "main" java.sql.SQLException: Socket read timed out
at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(Physi calConnection.java:
531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnect ion.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnectio n(T4CDriverExtensio
n.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:503)
at java.sql.DriverManager.getConnection(DriverManager .java:582)
at java.sql.DriverManager.getConnection(DriverManager .java:185)
at SelectTest.main(SelectTest.java:11)
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:2 86)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnec tion.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:301)
... 7 more
e:\JavaPrgms\JDBC>
So , Here i am using Windows7 64bit , Oracle 11g Releases 2 64bit version,
I tried same example with MySql database its working properly but here the socket is continuously reading and timeout exception is rised after 5 mins.. so how can i remove this exception ,?
i checked my port no in tnslistener.ora its "1521" and my sid is :"orcl" where the problem is ?