Switch to full style
What's behind JSP & Servlets
Post a reply

Closing connection in jsp

Wed Oct 22, 2008 12:49 am

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

Wed Oct 22, 2008 12:51 am

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.

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