You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org> on 2006/04/23 15:12:06 UTC

[jira] Updated: (DERBY-1234) Verify that we raise SQLException when calling methods on closed java.sql objects

     [ http://issues.apache.org/jira/browse/DERBY-1234?page=all ]

Knut Anders Hatlen updated DERBY-1234:
--------------------------------------

    Attachment: derby-1234-v1.diff
                derby-1234-v1.stat

I have written a test which invokes all methods on closed ResultSet,
Statement, PreparedStatement, CallableStatement and Connection objects
and checks whether they throw exceptions with SQL states indicating
that the object is closed. The test is attached if someone wants to
try it.

The test assumes that all methods except close() and isClosed() should
throw an exception. I don't know whether Connection.isValid() should
throw an exception, but I can't find anything in the spec saying it
shouldn't.

I noticed that embedded and client don't use the same SQL state for
closed statements. Embedded uses XJ012, while the client uses XCL31.

Results from running the test on embedded:

java.lang.UnsupportedOperationException thrown instead of
SQLFeatureNotSupportedException:

  EmbedConnection40.getTypeMap

No exceptions from:

  BrokeredCallableStatement40.getGeneratedKeys
  BrokeredCallableStatement40.getQueryTimeout
  BrokeredPreparedStatement40.getGeneratedKeys
  BrokeredPreparedStatement40.getQueryTimeout
  BrokeredStatement40.getGeneratedKeys
  BrokeredStatement40.getQueryTimeout
  EmbedCallableStatement40.getGeneratedKeys
  EmbedCallableStatement40.getQueryTimeout
  EmbedConnection40.clearWarnings
  EmbedConnection40.getAutoCommit
  EmbedConnection40.getCatalog
  EmbedConnection40.getHoldability
  EmbedConnection40.getWarnings
  EmbedConnection40.isValid
  EmbedConnection40.nativeSQL
  EmbedConnection40.setAutoCommit
  EmbedConnection40.setCatalog
  EmbedConnection40.setHoldability
  EmbedPreparedStatement40.getGeneratedKeys
  EmbedPreparedStatement40.getQueryTimeout
  EmbedStatement40.getGeneratedKeys
  EmbedStatement40.getQueryTimeout

NullPointerException or SQLException because of null argument:

  BrokeredCallableStatement40.getObject
  BrokeredCallableStatement40.isWrapperFor
  BrokeredCallableStatement40.setBinaryStream
  BrokeredCallableStatement40.setBlob
  BrokeredCallableStatement40.setCharacterStream
  BrokeredCallableStatement40.setClob
  BrokeredCallableStatement40.unwrap
  BrokeredConnection40.isWrapperFor
  BrokeredConnection40.unwrap
  BrokeredPreparedStatement40.isWrapperFor
  BrokeredPreparedStatement40.setBinaryStream
  BrokeredPreparedStatement40.setBlob
  BrokeredPreparedStatement40.setCharacterStream
  BrokeredPreparedStatement40.setClob
  BrokeredPreparedStatement40.unwrap
  BrokeredStatement40.execute
  BrokeredStatement40.executeQuery
  BrokeredStatement40.executeUpdate
  BrokeredStatement40.isWrapperFor
  BrokeredStatement40.unwrap
  EmbedCallableStatement40.getObject
  EmbedCallableStatement40.isWrapperFor
  EmbedCallableStatement40.setBinaryStream
  EmbedCallableStatement40.setBlob
  EmbedCallableStatement40.setCharacterStream
  EmbedCallableStatement40.setClob
  EmbedCallableStatement40.unwrap
  EmbedConnection40.createQueryObject
  EmbedConnection40.getTransactionIsolation
  EmbedConnection40.isReadOnly
  EmbedConnection40.isWrapperFor
  EmbedConnection40.setTransactionIsolation
  EmbedConnection40.setTypeMap
  EmbedConnection40.unwrap
  EmbedPreparedStatement40.isWrapperFor
  EmbedPreparedStatement40.setBinaryStream
  EmbedPreparedStatement40.setBlob
  EmbedPreparedStatement40.setCharacterStream
  EmbedPreparedStatement40.setClob
  EmbedPreparedStatement40.unwrap
  EmbedResultSet40.getAsciiStream
  EmbedResultSet40.getBigDecimal
  EmbedResultSet40.getBinaryStream
  EmbedResultSet40.getBlob
  EmbedResultSet40.getBoolean
  EmbedResultSet40.getByte
  EmbedResultSet40.getBytes
  EmbedResultSet40.getCharacterStream
  EmbedResultSet40.getClob
  EmbedResultSet40.getDate
  EmbedResultSet40.getDouble
  EmbedResultSet40.getFloat
  EmbedResultSet40.getInt
  EmbedResultSet40.getLong
  EmbedResultSet40.getObject
  EmbedResultSet40.getObject
  EmbedResultSet40.getShort
  EmbedResultSet40.getString
  EmbedResultSet40.getTime
  EmbedResultSet40.getTimestamp
  EmbedResultSet40.isWrapperFor
  EmbedResultSet40.unwrap
  EmbedResultSet40.updateAsciiStream
  EmbedResultSet40.updateBigDecimal
  EmbedResultSet40.updateBinaryStream
  EmbedResultSet40.updateBlob
  EmbedResultSet40.updateBoolean
  EmbedResultSet40.updateByte
  EmbedResultSet40.updateBytes
  EmbedResultSet40.updateCharacterStream
  EmbedResultSet40.updateClob
  EmbedResultSet40.updateDate
  EmbedResultSet40.updateDouble
  EmbedResultSet40.updateFloat
  EmbedResultSet40.updateInt
  EmbedResultSet40.updateLong
  EmbedResultSet40.updateNull
  EmbedResultSet40.updateObject
  EmbedResultSet40.updateShort
  EmbedResultSet40.updateString
  EmbedResultSet40.updateTime
  EmbedResultSet40.updateTimestamp
  EmbedStatement40.execute
  EmbedStatement40.executeQuery
  EmbedStatement40.executeUpdate
  EmbedStatement40.isWrapperFor
  EmbedStatement40.unwrap

AbstractMethodError:

  BrokeredConnection40.createArray
  BrokeredConnection40.createStruct
  BrokeredStatement40.isPoolable
  BrokeredStatement40.setPoolable
  EmbedConnection40.createArray
  EmbedConnection40.createStruct
  EmbedStatement40.isPoolable
  EmbedStatement40.setPoolable

SQLException, not scrollable or no current row:

  EmbedResultSet40.absolute
  EmbedResultSet40.afterLast
  EmbedResultSet40.beforeFirst
  EmbedResultSet40.first
  EmbedResultSet40.getAsciiStream
  EmbedResultSet40.getBinaryStream
  EmbedResultSet40.getCharacterStream
  EmbedResultSet40.getObject
  EmbedResultSet40.isAfterLast
  EmbedResultSet40.isBeforeFirst
  EmbedResultSet40.isFirst
  EmbedResultSet40.isLast
  EmbedResultSet40.last
  EmbedResultSet40.previous
  EmbedResultSet40.relative

Results from running the test on the client:

java.lang.UnsupportedOperationException thrown instead of
SQLFeatureNotSupportedException:

  NetConnection40.getTypeMap

No exceptions from:

  CallableStatement40.clearWarnings
  CallableStatement40.getWarnings
  CallableStatement40.setDate
  PreparedStatement40.clearWarnings
  PreparedStatement40.getWarnings
  Statement40.clearWarnings
  Statement40.getWarnings
  NetConnection40.clearWarnings
  NetConnection40.createBlob
  NetConnection40.createClob
  NetConnection40.getWarnings
  NetConnection40.isValid

NullPointerException or SQLException because of null argument:

  CallableStatement40.getDate
  CallableStatement40.getTime
  CallableStatement40.getTimestamp
  CallableStatement40.isWrapperFor
  CallableStatement40.setClob
  CallableStatement40.setDate
  CallableStatement40.setTime
  CallableStatement40.setTimestamp
  CallableStatement40.unwrap
  PreparedStatement40.isWrapperFor
  PreparedStatement40.setClob
  PreparedStatement40.setDate
  PreparedStatement40.setTime
  PreparedStatement40.setTimestamp
  PreparedStatement40.unwrap
  Statement40.isWrapperFor
  Statement40.unwrap
  NetConnection40.createQueryObject
  NetConnection40.isWrapperFor
  NetConnection40.unwrap
  NetResultSet40.getDate
  NetResultSet40.getTime
  NetResultSet40.getTimestamp
  NetResultSet40.getURL
  NetResultSet40.isWrapperFor
  NetResultSet40.unwrap
  NetResultSet40.updateArray
  NetResultSet40.updateBlob
  NetResultSet40.updateClob
  NetResultSet40.updateRef

AbstractMethodError:

  LogicalConnection.createArray
  LogicalConnection.createBlob
  LogicalConnection.createClob
  LogicalConnection.createNClob
  LogicalConnection.createQueryObject
  LogicalConnection.createSQLXML
  LogicalConnection.createStruct
  LogicalConnection.getClientInfo
  LogicalConnection.getClientInfo
  LogicalConnection.isValid
  LogicalConnection.isWrapperFor
  LogicalConnection.setClientInfo
  LogicalConnection.setClientInfo
  LogicalConnection.unwrap
  Statement40.isPoolable
  Statement40.setPoolable
  NetConnection40.createArray
  NetConnection40.createStruct
  NetResultSet40.getNCharacterStream
  NetResultSet40.getNCharacterStream
  NetResultSet40.getNString
  NetResultSet40.getNString
  NetResultSet40.updateNCharacterStream
  NetResultSet40.updateNCharacterStream

> Verify that we raise SQLException when calling methods on closed java.sql objects
> ---------------------------------------------------------------------------------
>
>          Key: DERBY-1234
>          URL: http://issues.apache.org/jira/browse/DERBY-1234
>      Project: Derby
>         Type: Improvement

>   Components: JDBC
>     Versions: 10.2.0.0
>     Reporter: Rick Hillegas
>     Assignee: Knut Anders Hatlen
>      Fix For: 10.2.0.0
>  Attachments: derby-1234-v1.diff, derby-1234-v1.stat
>
> The next rev of the JDBC4 spec will clarify that databases should raise SQLException when an application calls methods on closed sql objects: ResultSet, Preparedstatement, CallableStatement, Connection, and Statement. We should verify that we conform.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira