Deepa Remesh wrote:
> Should a JDBC driver close the statement objects associated with a
> connection when the connection's close() method is called?
> 
> I saw this in JDBC 3.0 spec (Section 13.1.3 Closing Statement Objects)
> "All Statement objects will be closed when the connection that created
> them is closed." But I found different behaviour with Derby embedded
> and client driver. When using embedded driver, it does not close the
> associated statement objects when connection.close() is called. In
> client driver, the connection object maintains a list of all open
> statements and closes them when connection.close() is called.
> 
> I'd appreciate if someone can explain this difference and which
> behaviour is correct.

I think you are seeing different implementations, but the behaviour is
the same. The close of the connection in embedded implicitly closes the
Statement object. Once an embedded connection is closed, any call on a
Statement object will result in an exception indicating the object is
closed.

Dan.

Reply via email to