JDBC interfaces should extend a Closable interface

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P5
    • None
    • Affects Version/s: 6
    • Component/s: core-libs
    • x86
    • windows_2000

      A DESCRIPTION OF THE REQUEST :
      Connection, ResultSet, Statement and any other suitable JDBC interfaces should extend a Closable interface.

      JUSTIFICATION :
      Boilerplate code must currently be duplicated to handle each resource separately. Justification for this is equivalent to the need for java.io.Closable to manage stream resources.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Connection c = DriverManager.getConnection(...);
      PreparedStatement ps = c.prepare(....);
      ResultSet rs = ps.executeQuery();
      // ...
      Closable c1 = c;
      Closable c2 = ps;
      Closable c3 = rs;

      c1.close();
      c2.close();
      c3.close();

      ACTUAL -
      There is currently no such interface. java.io.Closable exists, but does not throw an exception; a suitable java.sql.Closable interface would presumably need to throw a SQLException.

            Assignee:
            Lance Andersen
            Reporter:
            Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: