United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5105637 Closeable interface for classes in java.sql package
JDK-5105637 : Closeable interface for classes in java.sql package

Details
Type:
Enhancement
Submit Date:
2004-09-22
Status:
Closed
Updated Date:
2010-07-08
Project Name:
JDK
Resolved Date:
2006-03-01
Component:
core-libs
OS:
windows_xp
Sub-Component:
java.sql
CPU:
x86
Priority:
P4
Resolution:
Won't Fix
Affected Versions:
1.4.2
Fixed Versions:

Related Reports

Sub Tasks

Description
Name: jl125535			Date: 09/22/2004


A DESCRIPTION OF THE REQUEST :
Finally the classes in java.io have implemented a Closeable interface, so you can write one close method that takes a Closeable argument. I have waiting for this feature to be added for a long time, and it made me glad when I saw that the interface was added to JDK 1.5. But to my disappointment the interface wasn't also added to the java.sql package.

In short. Let the interfaces
java.sql.Statement
java.sql.ResultSet
java.sql.Connection

extend a Closeable interface.

The close method in the Closeable interface in the java.io package declares that it throws an IOException, so it can't be used. You could either make IOException and SQLException extend/implement a common base, and alter the Closeable interface so it declares that the close method throws that common base, or duplicate the interface, and place it in java.sql package as well. I guess there are other ways to solve it as well.


JUSTIFICATION :
As it is now we have to write close methods that are overloaded with different arguments.

I would like to be able to write one close method that can close statements, result sets and connections.
(Incident Review ID: 311502) 
======================================================================

                                    

Comments
EVALUATION

Will not be incorporating this interface into JDBC
                                     
2006-03-01
EVALUATION

One of the reasons is this requires an IOException to be thrown and JDBC requires a SQLException
                                     
2006-03-01



Hardware and Software, Engineered to Work Together