Derby
  1. Derby
  2. DERBY-5910

Document use of Connection.close() with try-with-resources

    Details

      Description

      The Java SE 7 try-with-resources feature can cause problems with AutoCloseable objects like java.sql.Connection. You must be careful when writing portable code which declares Connections in the initializers of try-with-resources blocks, because Derby raises an exception if you try to close a Connection with uncommitted work in-flight.

      Changing Derby's Connection.close() to always commit in-flight work (and not raise an exception) would create backward compatibility issues, but we do not know yet how serious these issues would be, owing to a lack of data.

      Rather than change Derby's behavior now, we should document how Derby's Connection.close() behaves and describe the portability issues involved in declaring Derby Connections in try-with-resources initializers.

      1. DERBY-5910-4.zip
        6 kB
        Kim Haase
      2. DERBY-5910-4.diff
        7 kB
        Kim Haase
      3. DERBY-5910-3.zip
        6 kB
        Kim Haase
      4. DERBY-5910-3.diff
        6 kB
        Kim Haase
      5. DERBY-5910-2.zip
        6 kB
        Kim Haase
      6. DERBY-5910-2.diff
        6 kB
        Kim Haase
      7. DERBY-5910.zip
        6 kB
        Kim Haase
      8. DERBY-5910.stat
        0.1 kB
        Kim Haase
      9. DERBY-5910.diff
        5 kB
        Kim Haase

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Kim Haase
            Reporter:
            Kim Haase
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development