Closing connection in jsp

Tue Oct 21, 2008 11:49 pm

Hi,
I am developing web application and i need a advice. I have opened a lot of
db connections in my classes and everytime i do not want to write
resultset.close() vs in my classes so i have written a static method which
close my db connection. Whenever i need to close db connection I call this
method. Do you think it is the best approach to close db connections or do
you have better solutions.
Thanks...



Re: Closing connection in jsp

Tue Oct 21, 2008 11:51 pm

However, if you're working with a web application, have you thought of
using Connection Pooling? Typically, the pool sets up a Data Source
object in the JNDI tree. When you want a connection, you call the data
source to get a connection. Your static method returns the connection to
the pool.

This interface is typically done in a single database interface class.
This class has methods to do selects, inserts, etc., and these methods
typically deal with connections, so most of the program knows nothing
about them.

  Related Posts  to : Closing connection in jsp
 GeoCities is closing     -  
 error closing file matlab save     -  
 Connection object in jsp     -  
 How to use connection object in jsp     -  
 database connection     -  
 Mobile to PC connection using Bluetooth     -  
 Connection Reset By Peer     -  
 Bluetooth connection using C# (won't work)     -  
 Using java in http connection     -  
 establish a connection with MySQL in php     -