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

EmbedResultSet.getString() returns wrong value after auto-commit with CLOSE_CURSORS_AT_COMMIT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.3.1.4, 10.3.2.1, 10.4.1.3
    • 10.3.3.0, 10.4.1.3
    • JDBC
    • None
    • Regression

    Description

      The following code prints "null" to the console with the embedded driver:

      Statement s = c.createStatement(ResultSet.TYPE_FORWARD_ONLY,
      ResultSet.CONCUR_READ_ONLY,
      ResultSet.CLOSE_CURSORS_AT_COMMIT);
      ResultSet rs = s.executeQuery("select * from sysibm.sysdummy1");
      rs.next();
      c.createStatement().executeQuery("values 1").close(); // causes auto-commit
      System.out.println(rs.getString(1));

      The call to rs.getString() should perhaps have thrown SQLException, since the auto-commit between next() and getString() should close the ResultSet when the holdability is CLOSE_CURSORS_AT_COMMIT, I think. Anyway, the value stored in SYSIBM.SYSDUMMY1 is 'Y' and not NULL, so it should definitely not return null.

      Attachments

        1. CloseOnCommit.java
          0.7 kB
          Knut Anders Hatlen
        2. d3404-v1.diff
          7 kB
          Knut Anders Hatlen
        3. d3404-v1.stat
          0.5 kB
          Knut Anders Hatlen

        Activity

          People

            knutanders Knut Anders Hatlen
            knutanders Knut Anders Hatlen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: