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

Result sets of type TYPE_SCROLL_INSENSITIVE should not implicitly close due to positioning in autocommit mode

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6
    • Fix Version/s: 10.2.1.6
    • Component/s: JDBC
    • Labels:
      None
    • Issue & fix info:
      Release Note Needed

      Description

      The new JDBC 4 specification allows implementations to automatically
      close result sets of type FORWARD_ONLY when ResultSet#next returns
      false:

      (quote from JDBC preliminary spec):

      > 16.2.5 Closing a ResultSet Object
      > :
      > NOTE: Some JDBC driver implementations may also implicitly close the
      > ResultSet when the ResultSet type is TYPE_FORWARD_ONLY and the next
      > method of ResultSet returns false.

      This implies that other result set type are not free to do this.

      Currently, Derby will also implicitly close result sets of type
      TYPE_SCROLL_INSENSITIVE, if autocommit is enabled.

      Quote from Derby Developer's Guide, subsection "Using autocommit":

      > Using auto-commit
      >
      > A new connection to a Derby database is in auto-commit mode by
      > default, as specified by the JDBC standard. Auto-commit mode means
      > that when a statement is completed, the method commit is called on
      > that statement automatically. Auto-commit in effect makes every SQL
      > statement a transaction. The commit occurs when the statement
      > completes or the next statement is executed, whichever comes
      > first. In the case of a statement returning a ResultSet , the
      > statement completes when the last row of the ResultSet has been
      ****************************************
      > retrieved or the ResultSet has been closed explicitly.

      This seems to indicate that result set always closes when the last row
      has been seen, however, it seems the implementation only does this
      when autocommit is enabled. I will attach a repro.

      Anyway, this should be corrected for JDBC4 compliancy. Scrollable
      result sets should never close implicitly due to positioning,
      autocommit or not.

        Attachments

        1. Main.java
          7 kB
          Dag H. Wanvik
        2. derby-1295v3.stat
          0.6 kB
          Andreas Korneliussen
        3. derby-1295v3.diff
          10 kB
          Andreas Korneliussen
        4. derby-1295v2.stat
          0.6 kB
          Fernanda Pizzorno
        5. derby-1295v2.diff
          10 kB
          Fernanda Pizzorno
        6. derby-1295.stat
          0.6 kB
          Fernanda Pizzorno
        7. derby-1295.diff
          10 kB
          Fernanda Pizzorno

          Activity

            People

            • Assignee:
              fernanda Fernanda Pizzorno
              Reporter:
              dagw Dag H. Wanvik
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: