GeeCON Prague 2014*
The moose likes JDBC and the fly likes closing connection and statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "closing connection and statement" Watch "closing connection and statement" New topic
Author

closing connection and statement

eswar kumar
Ranch Hand

Joined: Oct 20, 2002
Posts: 98
what will happen if i closed a connection without closing a statement?will it affect next time when i am retriving data from data base ?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Closing a connection will close the statement, since the statement depends on it. It's good practice to explicitly close the statement though.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
It is expecially good practice when using connection pooling (calling connection.close() doesn't really close the connection). You can't be sure that the connection pool implementer is keeping track of your statements and closing them for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: closing connection and statement