You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Emerson Cargnin <em...@tre-sc.gov.br> on 2004/07/15 21:40:06 UTC

DBCP pool

Is there a way to set the database timeout in dbcp??? I have a database 
which I have no control under its timeout. I used a pool api that 
allowed me to set the database timeout, but as I want to move to DBCP, 
is there a way to set this???


-- 
Emerson Cargnin
Analista de Sistemas - Gerente Regional - Tubarão
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP pool

Posted by Mike Curwen <g_...@globallyboundless.com>.
http://jakarta.apache.org/commons/dbcp/configuration.html


> -----Original Message-----
> From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
> Sent: Thursday, July 15, 2004 4:40 PM
> To: Tomcat Users List
> Subject: Re: DBCP pool
> 
> 
> If testOnBorrow is not true, when is it tested?
> 
> 
> 
> 
> Mike Curwen wrote:
> > I'm not an expert, but I suspect that the resource config 
> parameters 
> > will act like javabean setters.  So you should be able to specify 
> > something like:
> >  
> > <parameter>
> >    <name>validationQuery</name>
> >    <value>SELECT 1</value>
> > </parameter>
> > <parameter>
> >    <name>testOnBorrow</name>
> >    <value>true</value>
> > </parameter>
> > 
> > 
> > 
> >>-----Original Message-----
> >>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br]
> >>Sent: Thursday, July 15, 2004 4:30 PM
> >>To: Tomcat Users List
> >>Subject: Re: DBCP pool
> >>
> >>
> >>How do I specify the test query as context param? There is 
> nothing in
> >>the JDBC configuration of DBCP in tomcat 5 docs.
> >>BTW, I found some typos erros, must I create a bug, or may I 
> >>put it here?
> >>
> >>other question:
> >>
> >>May I mix the Resource and ResourceParams tags?? I'm asking
> >>this because 
> >>I have  to configure 2 connection in some apps, so I must put 
> >>a Resource 
> >>and a ResourceParams tag sequencially for each connection I want to 
> >>configure??
> >>
> >>Thanks for your response
> >>
> >>Emerson
> >>
> >>Mike Curwen wrote:
> >>
> >>>I think the way to do this with DBCP is to specify a test
> >>
> >>query.  The
> >>
> >>>pool would then run this query (like "SELECT 1") before
> >>
> >>giving out the
> >>
> >>>connection. If it failed (and if it's because the connection is
> >>>closed), it will null this connection in the pool, open a new 
> >>>connection, and retest it, and then give this one out.
> >>> 
> >>>If any of that is factually wrong, someone will be sure to
> >>
> >>jump in and
> >>
> >>>correct me.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br]
> >>>>Sent: Thursday, July 15, 2004 3:03 PM
> >>>>To: Tomcat Users List
> >>>>Subject: Re: DBCP pool
> >>>>
> >>>>
> >>>>none of them, I mean the timeout set in database, the 
> maximum life 
> >>>>time for an connection. This is used when you have a 
> database that 
> >>>>has a given timeout, let's say, 10 minutes, so you can't have this
> >>>>connection 
> >>>>opened for more than 10 minutes, what would case an error 
> due to an 
> >>>>timeouted connection.
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>------------------------------------------------------------
> ---------
> >>
> >>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >>
> >>-- 
> >>Emerson Cargnin
> >>Analista de Sistemas - Gerente Regional - Tubarão
> >>Setor de Desenvolvimento de Sistemas - TRE-SC
> >>tel : (048) - 251-3700 - Ramal 3181
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Emerson Cargnin
> Analista de Sistemas - Gerente Regional - Tubarão
> Setor de Desenvolvimento de Sistemas - TRE-SC
> tel : (048) - 251-3700 - Ramal 3181
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP pool

Posted by Emerson Cargnin <em...@tre-sc.gov.br>.
If testOnBorrow is not true, when is it tested?




Mike Curwen wrote:
> I'm not an expert, but I suspect that the resource config parameters
> will act like javabean setters.  So you should be able to specify
> something like:
>  
> <parameter>
>    <name>validationQuery</name>
>    <value>SELECT 1</value>
> </parameter>
> <parameter>
>    <name>testOnBorrow</name>
>    <value>true</value>
> </parameter>
> 
> 
> 
>>-----Original Message-----
>>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
>>Sent: Thursday, July 15, 2004 4:30 PM
>>To: Tomcat Users List
>>Subject: Re: DBCP pool
>>
>>
>>How do I specify the test query as context param? There is nothing in 
>>the JDBC configuration of DBCP in tomcat 5 docs.
>>BTW, I found some typos erros, must I create a bug, or may I 
>>put it here?
>>
>>other question:
>>
>>May I mix the Resource and ResourceParams tags?? I'm asking 
>>this because 
>>I have  to configure 2 connection in some apps, so I must put 
>>a Resource 
>>and a ResourceParams tag sequencially for each connection I want to 
>>configure??
>>
>>Thanks for your response
>>
>>Emerson
>>
>>Mike Curwen wrote:
>>
>>>I think the way to do this with DBCP is to specify a test 
>>
>>query.  The 
>>
>>>pool would then run this query (like "SELECT 1") before 
>>
>>giving out the 
>>
>>>connection. If it failed (and if it's because the connection is 
>>>closed), it will null this connection in the pool, open a new 
>>>connection, and retest it, and then give this one out.
>>> 
>>>If any of that is factually wrong, someone will be sure to 
>>
>>jump in and 
>>
>>>correct me.
>>>
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br]
>>>>Sent: Thursday, July 15, 2004 3:03 PM
>>>>To: Tomcat Users List
>>>>Subject: Re: DBCP pool
>>>>
>>>>
>>>>none of them, I mean the timeout set in database, the maximum
>>>>life time 
>>>>for an connection. This is used when you have a database that has a 
>>>>given timeout, let's say, 10 minutes, so you can't have this 
>>>>connection 
>>>>opened for more than 10 minutes, what would case an error due to an 
>>>>timeouted connection.
>>>>
>>>>
>>>
>>>
>>>
>>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>-- 
>>Emerson Cargnin
>>Analista de Sistemas - Gerente Regional - Tubarão
>>Setor de Desenvolvimento de Sistemas - TRE-SC
>>tel : (048) - 251-3700 - Ramal 3181
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
Emerson Cargnin
Analista de Sistemas - Gerente Regional - Tubarão
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP pool

Posted by Mike Curwen <g_...@globallyboundless.com>.
I'm not an expert, but I suspect that the resource config parameters
will act like javabean setters.  So you should be able to specify
something like:
 
<parameter>
   <name>validationQuery</name>
   <value>SELECT 1</value>
</parameter>
<parameter>
   <name>testOnBorrow</name>
   <value>true</value>
</parameter>



> -----Original Message-----
> From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
> Sent: Thursday, July 15, 2004 4:30 PM
> To: Tomcat Users List
> Subject: Re: DBCP pool
> 
> 
> How do I specify the test query as context param? There is nothing in 
> the JDBC configuration of DBCP in tomcat 5 docs.
> BTW, I found some typos erros, must I create a bug, or may I 
> put it here?
> 
> other question:
> 
> May I mix the Resource and ResourceParams tags?? I'm asking 
> this because 
> I have  to configure 2 connection in some apps, so I must put 
> a Resource 
> and a ResourceParams tag sequencially for each connection I want to 
> configure??
> 
> Thanks for your response
> 
> Emerson
> 
> Mike Curwen wrote:
> > I think the way to do this with DBCP is to specify a test 
> query.  The 
> > pool would then run this query (like "SELECT 1") before 
> giving out the 
> > connection. If it failed (and if it's because the connection is 
> > closed), it will null this connection in the pool, open a new 
> > connection, and retest it, and then give this one out.
> >  
> > If any of that is factually wrong, someone will be sure to 
> jump in and 
> > correct me.
> > 
> > 
> > 
> > 
> >>-----Original Message-----
> >>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br]
> >>Sent: Thursday, July 15, 2004 3:03 PM
> >>To: Tomcat Users List
> >>Subject: Re: DBCP pool
> >>
> >>
> >>none of them, I mean the timeout set in database, the maximum
> >>life time 
> >>for an connection. This is used when you have a database that has a 
> >>given timeout, let's say, 10 minutes, so you can't have this 
> >>connection 
> >>opened for more than 10 minutes, what would case an error due to an 
> >>timeouted connection.
> >>
> >>
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Emerson Cargnin
> Analista de Sistemas - Gerente Regional - Tubarão
> Setor de Desenvolvimento de Sistemas - TRE-SC
> tel : (048) - 251-3700 - Ramal 3181
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP pool

Posted by Emerson Cargnin <em...@tre-sc.gov.br>.
How do I specify the test query as context param? There is nothing in 
the JDBC configuration of DBCP in tomcat 5 docs.
BTW, I found some typos erros, must I create a bug, or may I put it here?

other question:

May I mix the Resource and ResourceParams tags?? I'm asking this because 
I have  to configure 2 connection in some apps, so I must put a Resource 
and a ResourceParams tag sequencially for each connection I want to 
configure??

Thanks for your response

Emerson

Mike Curwen wrote:
> I think the way to do this with DBCP is to specify a test query.  The
> pool would then run this query (like "SELECT 1") before giving out the
> connection. If it failed (and if it's because the connection is closed),
> it will null this connection in the pool, open a new connection, and
> retest it, and then give this one out.
>  
> If any of that is factually wrong, someone will be sure to jump in and
> correct me.
> 
> 
> 
> 
>>-----Original Message-----
>>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
>>Sent: Thursday, July 15, 2004 3:03 PM
>>To: Tomcat Users List
>>Subject: Re: DBCP pool
>>
>>
>>none of them, I mean the timeout set in database, the maximum 
>>life time 
>>for an connection. This is used when you have a database that has a 
>>given timeout, let's say, 10 minutes, so you can't have this 
>>connection 
>>opened for more than 10 minutes, what would case an error due to an 
>>timeouted connection.
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
Emerson Cargnin
Analista de Sistemas - Gerente Regional - Tubarão
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP pool

Posted by Mike Curwen <g_...@globallyboundless.com>.
 <Resource name="jdbc/TestDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/TestDB">
	
	ONE SET OF PARAMETER TAGS
  </ResourceParams>


 <Resource name="jdbc/AnotherDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/AnotherDB">
   
       SECOND SET OF PARAMETER TAGS
  </ResourceParams>


That's the way I'd do it.


> -----Original Message-----
> From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
> Sent: Thursday, July 15, 2004 4:40 PM
> To: Tomcat Users List
> Subject: Re: DBCP pool
> 
> 
> What about this other question:
> 
> May I mix the Resource and ResourceParams tags?? I'm asking 
> this because I have  to configure 2 connection in some apps, 
> so I must put a Resource and a ResourceParams tag 
> sequencially for each connection I want to configure??
> 
> Thanks for your response
> 
> Emerson
> 
> Mike Curwen wrote:
> > I think the way to do this with DBCP is to specify a test 
> query.  The 
> > pool would then run this query (like "SELECT 1") before 
> giving out the 
> > connection. If it failed (and if it's because the connection is 
> > closed), it will null this connection in the pool, open a new 
> > connection, and retest it, and then give this one out.
> >  
> > If any of that is factually wrong, someone will be sure to 
> jump in and 
> > correct me.
> > 
> > 
> > 
> > 
> >>-----Original Message-----
> >>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br]
> >>Sent: Thursday, July 15, 2004 3:03 PM
> >>To: Tomcat Users List
> >>Subject: Re: DBCP pool
> >>
> >>
> >>none of them, I mean the timeout set in database, the maximum
> >>life time 
> >>for an connection. This is used when you have a database that has a 
> >>given timeout, let's say, 10 minutes, so you can't have this 
> >>connection 
> >>opened for more than 10 minutes, what would case an error due to an 
> >>timeouted connection.
> >>
> >>
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Emerson Cargnin
> Analista de Sistemas - Gerente Regional - Tubarão
> Setor de Desenvolvimento de Sistemas - TRE-SC
> tel : (048) - 251-3700 - Ramal 3181
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP pool

Posted by Emerson Cargnin <em...@tre-sc.gov.br>.
What about this other question:

May I mix the Resource and ResourceParams tags?? I'm asking this because
I have  to configure 2 connection in some apps, so I must put a Resource
and a ResourceParams tag sequencially for each connection I want to
configure??

Thanks for your response

Emerson

Mike Curwen wrote:
> I think the way to do this with DBCP is to specify a test query.  The
> pool would then run this query (like "SELECT 1") before giving out the
> connection. If it failed (and if it's because the connection is closed),
> it will null this connection in the pool, open a new connection, and
> retest it, and then give this one out.
>  
> If any of that is factually wrong, someone will be sure to jump in and
> correct me.
> 
> 
> 
> 
>>-----Original Message-----
>>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
>>Sent: Thursday, July 15, 2004 3:03 PM
>>To: Tomcat Users List
>>Subject: Re: DBCP pool
>>
>>
>>none of them, I mean the timeout set in database, the maximum 
>>life time 
>>for an connection. This is used when you have a database that has a 
>>given timeout, let's say, 10 minutes, so you can't have this 
>>connection 
>>opened for more than 10 minutes, what would case an error due to an 
>>timeouted connection.
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
Emerson Cargnin
Analista de Sistemas - Gerente Regional - Tubarão
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP pool

Posted by Mike Curwen <g_...@globallyboundless.com>.
I think the way to do this with DBCP is to specify a test query.  The
pool would then run this query (like "SELECT 1") before giving out the
connection. If it failed (and if it's because the connection is closed),
it will null this connection in the pool, open a new connection, and
retest it, and then give this one out.
 
If any of that is factually wrong, someone will be sure to jump in and
correct me.



> -----Original Message-----
> From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
> Sent: Thursday, July 15, 2004 3:03 PM
> To: Tomcat Users List
> Subject: Re: DBCP pool
> 
> 
> none of them, I mean the timeout set in database, the maximum 
> life time 
> for an connection. This is used when you have a database that has a 
> given timeout, let's say, 10 minutes, so you can't have this 
> connection 
> opened for more than 10 minutes, what would case an error due to an 
> timeouted connection.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP pool

Posted by Emerson Cargnin <em...@tre-sc.gov.br>.
none of them, I mean the timeout set in database, the maximum life time 
for an connection. This is used when you have a database that has a 
given timeout, let's say, 10 minutes, so you can't have this connection 
opened for more than 10 minutes, what would case an error due to an 
timeouted connection.

Mike Curwen wrote:
> what timeout?
> 
> the amount of time it keeps an idle connection in the pool?
> the amount of time it waits before considering a connection abandoned?
> 
> 
> 
>>-----Original Message-----
>>From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
>>Sent: Thursday, July 15, 2004 2:40 PM
>>To: Tomcat Users List
>>Subject: DBCP pool
>>
>>
>>Is there a way to set the database timeout in dbcp??? I have 
>>a database 
>>which I have no control under its timeout. I used a pool api that 
>>allowed me to set the database timeout, but as I want to move 
>>to DBCP, 
>>is there a way to set this???
>>
>>
>>-- 
>>Emerson Cargnin
>>Analista de Sistemas - Gerente Regional - Tubarão
>>Setor de Desenvolvimento de Sistemas - TRE-SC
>>tel : (048) - 251-3700 - Ramal 3181
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
Emerson Cargnin
Analista de Sistemas - Gerente Regional - Tubarão
Setor de Desenvolvimento de Sistemas - TRE-SC
tel : (048) - 251-3700 - Ramal 3181

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP pool

Posted by Mike Curwen <g_...@globallyboundless.com>.
what timeout?

the amount of time it keeps an idle connection in the pool?
the amount of time it waits before considering a connection abandoned?


> -----Original Message-----
> From: Emerson Cargnin [mailto:emerson@tre-sc.gov.br] 
> Sent: Thursday, July 15, 2004 2:40 PM
> To: Tomcat Users List
> Subject: DBCP pool
> 
> 
> Is there a way to set the database timeout in dbcp??? I have 
> a database 
> which I have no control under its timeout. I used a pool api that 
> allowed me to set the database timeout, but as I want to move 
> to DBCP, 
> is there a way to set this???
> 
> 
> -- 
> Emerson Cargnin
> Analista de Sistemas - Gerente Regional - Tubarão
> Setor de Desenvolvimento de Sistemas - TRE-SC
> tel : (048) - 251-3700 - Ramal 3181
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org