File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Cascading object close() statements Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JDBC
Reply Bookmark "Cascading object close() statements" Watch "Cascading object close() statements" New topic
Author

Cascading object close() statements

Andrew Sweeney
Greenhorn

Joined: Jan 11, 2002
Posts: 26
HEllo all,
I'm interested in knowing the order in which JDBC objects are cascaded when closed. My understanding is that when a Connection object is closed, the underlying Statement objects and ResultSet objects are also closed. Is this always the case? Thanks!
Mahesh Mamani
Ranch Hand

Joined: Jun 25, 2001
Posts: 110
Hi,
When we close a Statement object, the associated ResultSet object is closed automatically. The Connection object will have to be closed explicitly. Here's an extract from the Java API :
"A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results."
Hope it helps.

Mahesh
 
 
subject: Cascading object close() statements
 
Threads others viewed
Question regarding Hibernate Lazy Loading
ResultSet question
Open Connection Objects
How to not open a named regular window if it already exisits
How to know if any of the CMP fileds are modified ?
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture