Environment: Eclipse(luna)
I am not able to retrive data from the oracle database 11g (11.2.0.2) used jdbe 6
I am getting the following two exception
java.sql.SQLRecoverableException
oracle.net.ns.NetException
Here is the code
import java.sql.*;
public class JavaConnection {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","******","*******");
Statement st=con.createStatement();
String sql="select * from emp";
ResultSet rs=st.executeQuery(sql);
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2));
con.close();
}
}
the exception thrown is
Exception in thread "main" java.sql.SQLRecoverableException: IO Error: Got minus one from a read call
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:553) at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:254) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at emodatabase.JavaConnection.main(JavaConnection.java:9)
Caused by: oracle.net.ns.NetException: Got minus one from a read call
at oracle.net.ns.Packet.receive(Packet.java:311) at oracle.net.ns.NSProtocol.connect(NSProtocol.java:300) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340) ... 7 more
What is cause that is causing it and how to resolve it?