Re: Defining data-sources in tomcat

2007-04-27 Thread Rashmi Rubdi
On 4/27/07, David Smith <[EMAIL PROTECTED]> wrote: But the code you posted does not create a new DataSource object. It just gets a reference to an existing one stored in JNDI. Nothing new about the DataSource object. Note the lack of a new operator. Good post, thank you for pointing this. T

Re: Defining data-sources in tomcat

2007-04-27 Thread Rashmi Rubdi
On 4/27/07, Srinivas V. <[EMAIL PROTECTED]> wrote: Thanks for all the responses on this. The basic doubt I had was whether the JNDI lookup would create a new data-source on each lookup or just return the previously created one. A number of you had said that the latter was true. The reason I wasn'

RE: Defining data-sources in tomcat

2007-04-27 Thread Srinivas V.
epancy with the docs. Srinivas -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Friday, April 27, 2007 11:58 AM To: Tomcat Users List Subject: Re: Defining data-sources in tomcat But the code you posted does not create a new DataSource object. It just gets a

Re: Defining data-sources in tomcat

2007-04-27 Thread David Smith
But the code you posted does not create a new DataSource object. It just gets a reference to an existing one stored in JNDI. Nothing new about the DataSource object. Note the lack of a new operator. --David Rashmi Rubdi wrote: On 4/27/07, albrecht andrzejewski <[EMAIL PROTECTED]> wrote:

Re: Defining data-sources in tomcat

2007-04-27 Thread Rashmi Rubdi
On 4/27/07, Srinivas V. <[EMAIL PROTECTED]> wrote: Hello all I have a question about defining data-sources in tomcat. I have a webapp in which my servlets need to talk to a DB. This is my current setup: 1) I define data-sources (c3p0 connection pools) using the Resource tag in my META-INF/conte

Re: Defining data-sources in tomcat

2007-04-27 Thread Rashmi Rubdi
On 4/27/07, albrecht andrzejewski <[EMAIL PROTECTED]> wrote: >> 3) In my servlet init(), I lookup the data-source. Each lookup essentially >> instantiates an instance of the data-source. So a connection pool gets >> instantiated in each servlet's init. >> >> Now it doesn't make sense to create a

Re: Defining data-sources in tomcat

2007-04-27 Thread albrecht andrzejewski
3) In my servlet init(), I lookup the data-source. Each lookup essentially instantiates an instance of the data-source. So a connection pool gets instantiated in each servlet's init. Now it doesn't make sense to create a new connection pool in each servlet. So I'd like to create a single connec

Re: Defining data-sources in tomcat

2007-04-27 Thread David Smith
I don't think you are creating new database pools on each servlet init. Looks like you are just getting another reference to the DataSource object that's stored in the JNDI. Can you post the code you use in servlet.init() to get the DataSource? --David Srinivas V. wrote: Hello all I have