A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
closing connection and statement
Joined: Oct 20, 2002
Dec 20, 2003 04:04:00
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 ?
Joined: Nov 06, 2000
Dec 20, 2003 09:56:00
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
Joined: Feb 28, 2003
Dec 21, 2003 01:47:00
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:
subject: closing connection and statement
Connection from DataSource
Is connection.close(); enough?
ResultSet after DB closed
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014