Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2006
    Posts
    2

    Unanswered: java.sql.SQLException: Io exception: Got minus one from a r

    I wrote a simple code in getting connection from java to oracle 10g.I have set the classpath correctly. here is the code

    import java.sql.*;
    class TestConnection
    {
    public static void main(String[] args)
    {
    try
    {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con=DriverManager.getConnection("jdbcracleci:@localhost:8080rcl","system","abhishek");
    Statement stm=con.createStatement();
    System.out.println("Connection established successfully");
    con.close();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
    }

    Iam getting runtime exception
    java.sql.SQLException: Io exception: Got minus one from a read call
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java
    :111)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java
    :145)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java
    :254)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:386)
    at oracle.jdbc.driver.PhysicalConnection.(PhysicalCon nection.java:
    413)
    at oracle.jdbc.driver.T4CConnection.(T4CConnection.ja va:164)
    at oracle.jdbc.driver.T4CDriverExtension.getConnectio n(T4CDriverExtensio
    n.java:34)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:752)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at sql.OracleTest.main(OracleTest.java:12)

    please suggest me how to get rid of this solution....

    Thanks in advance

  2. #2
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    The stack trace does not match your code example: it says it comes from a class sql.OracleTest, but your example is called TestConnection

  3. #3
    Join Date
    Sep 2006
    Posts
    2

    java.sql.SQLException: ORA-12537: TNS:connection closed

    sorry, i forgot to change the name of the file ....while compiling this time i encountered different error..

    package sql;
    import java.sql.*;
    class TestConnection
    {
    public static void main(String[] args)
    {
    try
    {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con=DriverManager.getConnection("jdbcracleci:@localhost:8080rcl","system","abhishek");
    Statement stm=con.createStatement();
    System.out.println("Connection established successfully");
    con.close();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    }
    }

    java.sql.SQLException: ORA-12537: TNS:connection closed

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java
    :112)
    at oracle.jdbc.driver.T2CConnection.checkError(T2CCon nection.java:672)
    at oracle.jdbc.driver.T2CConnection.logon(T2CConnecti on.java:346)
    at oracle.jdbc.driver.PhysicalConnection.<init>(Physi calConnection.java:
    414)
    at oracle.jdbc.driver.T2CConnection.<init>(T2CConnect ion.java:132)
    at oracle.jdbc.driver.T2CDriverExtension.getConnectio n(T2CDriverExtensio
    n.java:78)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:801)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at sql.TestConnection.main(TestConnection.java:10)

    thanks for your reply.....tell me how to get rid of this problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •