Servlet and connection pooling and How To
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ashish_Kulkarni
Posted On:   Thursday, August 29, 2002 09:20 AM

Hi, I am using Connection pooling and storing the pool in servlet context and I have question about getting the connection from servlet context in a all servlets, I want to code a single class where the input paramter will be servlet context and session and this class will return me the connection depending upon some parameter in session. I want to keep it is one class so i can change my implementation in future and change only one class and my servlets will not be affected So any suggestions on doing this, one that i think that this class must have a static method which is synchronised so i dont have to create instance of this class in each servlet ,will synchronise slow the performance, what about using singleton pattern(any code    More>>

Hi,


I am using Connection pooling and storing the pool in servlet context and I have question about getting the connection from servlet context in a all servlets,
I want to code a single class where the input paramter will be servlet context and session and this class will return me the connection depending upon some parameter in session.
I want to keep it is one class so i can change my implementation in future and change only one class and my servlets will not be affected
So any suggestions on doing this, one that i think that this class must have a static method which is synchronised so i dont have to create instance of this class in each servlet ,will synchronise slow the performance, what about using singleton pattern(any code of singleton pattern)
Any suggestions...
Ashish

   <<Less

Re: Servlet and connection pooling and How To

Posted By:   Jens_Dibbern  
Posted On:   Thursday, August 29, 2002 09:24 AM

I think you should rely on JNDI e.g. with your Tomcat configuration (Tomcat JNDI Docs). You will need a connection pool as a JDBC Datasource and you can get it anywhere in your Tomcat server by a JNDI lookup.



HTH

Jens
About | Sitemap | Contact