Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    26

    Unanswered: Having problem with ResultSet

    Hello Everyone,
    I have an issue with resultset.
    I am executing one query and gettign the resultset and passing that resultset to another method where i am traversing through the resultset.
    When i iterate through the resultset i am getting exception
    my code looks like:

    //classOne
    void methonone(){
    String query="select * from tablenmae";
    Connection.createstatement();//created the connection
    Statement stmt = con.createStatement();//created the statement
    ResultSet rsRows=stmt.executeQuery(query);//getting the result
    methodtwo(rsRows)
    }
    // classTwo
    void methodtwo(ResultSet rs){
    rs.next()//throws an exception.
    }

    The exception is :
    com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.52.110] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null


    I dont really know why the resultset is closed...
    i would really appreciate if some one can help me out...

    Thanks,
    swati

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Just handle the result set in the first method. And throw out the second method.

    Andy

Posting Permissions

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