Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on Tomcat db connection pool

Status
Not open for further replies.

yacanna

Programmer
Oct 24, 2003
15
0
0
US
I am using Tomcat database connection pool. In my java class, Do I need to close database connection after I openned the connection and retrieved data from database.

I would appreciate any help on this.
 
Yes.
You should ALWAYS close a db connection.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
java.sql.Connection is interface, not a class, so the thing you got from pool is not actually the same what you got directly creating connection. When you call close on connection from pool, pool returns REAL connection to pool, so it become available for further reuse.
 
Thats true, but you should still always close the connection object - pooling does not negate that fact.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top