This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes JDBC object closing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC object closing" Watch "JDBC object closing" New topic
Author

JDBC object closing

Divyajot Ahluwalia
Ranch Hand

Joined: Nov 03, 2000
Posts: 46
hi,
what are the jdbc objects we must close after finishing a process?
db - mysql
web server - apache + tomcat
in a servlet i use a connection broker from javaexchange and in the service method get a connection and towards the end free the connection. I close the statement and the prepared statements. Should i also close the result set.
My application is repeatedly throwing a servlet exception and therefore stops.
Can u please help.
Regards,
dj
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
ya u shuld also close the resultsets if any.
jlrober
Greenhorn

Joined: Jun 25, 2001
Posts: 10
Actually, if you close the Statement only, it will automatically call ResultSet.close() on any resultsets using the statement closed. So you don't "HAVE" to close the resultset explicitly, but it may just be good habit.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC object closing