Home » Developer & Programmer » JDeveloper, Java & XML » Need Help - java.sql.SQLException: Io exception: Got minus one from Read Call
Need Help - java.sql.SQLException: Io exception: Got minus one from Read Call [message #270427] Wed, 26 September 2007 21:08
thecyclarion
Messages: 1
Registered: September 2007
Junior Member
I am using the JDBC Oracle thin client to connect to a 10G DB. I receive the following intermitent error
Exception in thread "main" java.sql.SQLException: Io exception: Got minus one from a read call.
Oracle Driver ojdbc14.jar.
JDK 1.5.0_06 (As I understand compatible with the ojdbc14 driver according to Oracle site doc)
...Listener is up.
...DB is up
...I can connect an query from sql/plus consistently
...I can often connect and query with the sample listed below but it also very often fails.

Code was copied from Oracle site as an example of using the thin client.
import java.sql.*;
class dbAccess {
  public static void main (String args []) throws SQLException
  {
        DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

        Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:MAX", "MAX", "MAX");
        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
        while (rset.next())
              System.out.println (rset.getString(1));   
        stmt.close();
  }
}


rundbAccess.bat - a little bat file to execute the test.
@echo off
echo This test will query Oracle 10g using the Oracle JDBC driver.
echo Press Control+C to abort.
pause
SETLOCAL
set JAVA_HOME=C:\Sun\J2EESDK1.4\jdk
set CLASSPATH=.;lib/ojdbc14.jar
java -classpath %CLASSPATH% dbAccess
ENDLOCAL
pause


Results when working:
C:\oracle\JDBC_T~1>rundbAccess
This test will query Oracle 10g using the Oracle JDBC driver.
Press Control+C to abort.
Press any key to continue . . .
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Press any key to continue . . .


Results when not working:
C:\oracle\JDBC_T~1>rundbAccess
This test will query Oracle 10g using the Oracle JDBC driver.
Press Control+C to abort.
Press any key to continue . . .
Exception in thread "main" java.sql.SQLException: Io exception: Got minus one fr
om a read call
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:146)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:255)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
414)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
n.java:35)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
        at java.sql.DriverManager.getConnection(DriverManager.java:525)
        at java.sql.DriverManager.getConnection(DriverManager.java:171)
        at dbAccess.main(dbAccess.java:7)
Press any key to continue . . .

C:\oracle\JDBC_T~1>


Any help is greatly appreciated.

Joseph

Previous Topic: JDBC Architecture
Next Topic: XML extract
Goto Forum:
  


Current Time: Fri Apr 19 11:18:27 CDT 2024