Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-213

ResultSet.next() after last row of FORWARD_ONLY cursor throws an SQL Exception with Network Server

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.1.1.0
    • 10.2.1.6
    • Network Client
    • None

    Description

      Network Server closes the result set if ResultSet.next() is
      called after the last row of the result set. The test code
      below throws the following exception.

      SQLState: null
      Severity: -99999
      Message: Invalid operation: result set closed
      com.ibm.db2.jcc.am.SqlException: Invalid operation: result set
      closed
      at
      com.ibm.db2.jcc.am.ResultSet.checkForClosedResultSet(ResultSet.j
      ava:3419)
      at
      com.ibm.db2.jcc.am.ResultSet.nextX(ResultSet.java:290)
      at
      com.ibm.db2.jcc.am.ResultSet.next(ResultSet.java:277)
      at AfterLast.test(AfterLast.java:75)
      at AfterLast.main(AfterLast.java:32)

      stmt.executeUpdate("CREATE TABLE TAB ( I INT)");
      stmt.executeUpdate("INSERT INTO TAB VALUES(1)");
      stmt.executeUpdate("INSERT INTO TAB VALUES(2)");
      String sql ="SELECT * from tab";
      ps = conn.prepareStatement(sql);
      ResultSet rs = ps.executeQuery();
      System.out.println(sql);
      while (rs.next())
      System.out.println(rs.getInt(1));
      try

      { System.out.println("one more next"); rs.next(); }

      catch (Exception e)

      { System.out.println("FAIL: next should return false not throw exception"); e.printStackTrace(); }

      Attachments

        1. Server.java
          0.3 kB
          Philip Wilder
        2. ResultSet Outline.pdf
          11 kB
          Philip Wilder
        3. resultset.java
          30 kB
          Philip Wilder
        4. IRCTranscript_June2_2005.txt
          13 kB
          Philip Wilder
        5. Derby213patch_Aug242005.patch
          38 kB
          Philip Wilder
        6. Derby213patch_Aug112005.patch
          466 kB
          Philip Wilder
        7. DERBY-213_irc_6_8_2005
          9 kB
          Katherine Marsden
        8. DERBY-213_irc_6_7_2005.txt
          9 kB
          Philip Wilder
        9. DERBY-213_irc_6_3_2005
          12 kB
          Katherine Marsden
        10. DERBY-213_6_9_2005.txt
          14 kB
          Philip Wilder
        11. DERBY-213_6_13_2005.txt
          12 kB
          Philip Wilder
        12. Create.java
          4 kB
          Philip Wilder
        13. Client.java
          6 kB
          Philip Wilder

        Issue Links

          Activity

            People

              acadia_student_01 Philip Wilder
              kmarsden Katherine Marsden
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: