Right now there is a spec difference WRT calling close subsequent
times on Connection/Statement being a no-op and on ResultSet throwing
an SQLException. I expect the restriction on ResultSet.close will be
lifted
-lance
Daniel John Debrunner (JIRA) wrote:
[ http://issues.apache.org/jira/browse/DERBY-1060?page=comments#action_12368127 ]
Daniel John Debrunner commented on DERBY-1060:
----------------------------------------------
I would guess application code. Statement.close() says it has no effect when the Statement is already closed, seems like it makes sense for ResultSet .close to be the same.
Making ResultSet.close throw an exception when it is closed seems to lead to more complicated cleanup code, that may not be inline with the typical example in a JDBC book, e.g.
Instead of
if (rs != null)
rs.close();
you would need
if (Irs != null && !rs.isClosed())
rs.close();
Other (incorrect?) code I''ve seen that would break with making close throw an exception is when the ResultSet is closed after the statement that created it, e.g.
ResultSet rs = ps.executeQuery();
....
ps.close();
rs.close();
ResultSet methods should throw exception when the ResultSet is closed
---------------------------------------------------------------------
Key: DERBY-1060
URL: http://issues.apache.org/jira/browse/DERBY-1060
Project: Derby
Type: Bug
Components: JDBC, Network Client, Newcomer
Versions: 10.2.0.0
Reporter: Knut Anders Hatlen
Priority: Minor
The JDBC 4 spec says:
Once a ResultSet has been closed, any attempt to access any of its
methods with the exception of the isClosed method will result in a
SQLException being thrown.
This is not always the case in Derby, and the behaviour is not the
same on the client driver and the embedded driver.
The following ResultSet methods do not throw an exception when the
result set is closed:
Client driver:
clearWarnings()
close()
getMetaData()
getStatement()
getWarnings()
Embedded driver:
close()
getConcurrency()
getRow()
getStatement()
getType()
rowDeleted()
rowInserted()
rowUpdated()
setFetchDirection()
getFetchDirection()
setFetchSize()
getFetchSize()
|
- Re: [jira] Commented: (DERBY-1060) ResultSet met... Lance J. Andersen
-