datasource retrieval for connection pool
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sidhartha_nagolu
Posted On:   Saturday, May 10, 2003 01:22 PM

hi i need to use a connection pool with tomcat (DBCP). i am retrieving a connection from pool in service method and closing it once when i am done. i need to know what exactly is the place where i should put the code which creates a conext and retrieves data sourse from it. do i need to put in the service method or in the jsp init() method, or in an object associated with the context. i know that keeping it in application context saves me time, but i want too know how expensive(time) are those operations and what is the appropriate design choice. in short, are the opertions initiating a context and retrieving a datasource, are those expensive operations? thank you    More>>

hi


i need to use a connection pool with tomcat (DBCP).

i am retrieving a connection from pool in service method and closing it once when i am done.

i need to know what exactly is the place where i should put the code which creates a conext and retrieves data sourse from it.

do i need to put in the service method or in the jsp init() method, or in an object associated with the context.

i know that keeping it in application context saves me time, but i want too know how expensive(time) are those operations and what is the appropriate design choice.

in short, are the opertions initiating a context and retrieving a datasource, are those expensive operations?


thank you for you time.

have a fruitful day.

   <<Less

Re: datasource retrieval for connection pool

Posted By:   Nick_Maiorano  
Posted On:   Sunday, May 11, 2003 06:55 AM

Sidhartha,



Retrieving a data source involves accessing jndi and this is usually an expensive operation. I would recommend you do this only once (in the init method). Creating a connection, however, can and must be done before processing a request.

About | Sitemap | Contact