db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel John Debrunner (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1060) ResultSet methods should throw exception when the ResultSet is closed
Date Tue, 28 Feb 2006 17:24:41 GMT
    [ 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)

you would need

  if (Irs != null && !rs.isClosed())

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();


> 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:
>     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()

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message