You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Bachler, Elisabeth (Elisabeth)" <eb...@lucent.com> on 2004/07/08 14:24:20 UTC

Limit time for Database connection

Hello,
I defined a database connection that uses a pool connection. Everything is
working well.
Now I had a routing problem that prevented any database connection (with a
SQPNestedException fired). The exception fired after a long time.... is
there a way of setting the connection limit, so it does not take so long
before firing the exception?

Thanks
Elisabeth

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


Re: Limit time for Database connection

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
See my previous post on the thread.

Combined with "testOnBorrow" and/or "testWhileIdle", it could certainly 
help.

justin


At 05:56 PM 7/8/2004, you wrote:
>Could be, anyone know for sure?
>
>Eric Noel wrote:
>
>>I thought it would be just as simple as setting the parameter in the 
>>DBCP???
>>
>><parameter>
>>       <name>maxWait</name>
>>       <value>10000</value>
>></parameter>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>On 7/9/2004 8:11 AM, Robert F. Hall wrote:
>>
>>>Elisabeth,
>>>
>>>Nobody has responded to your question (that I've seen), so I'll "take 
>>>a shot".
>>>
>>>This sounds like a network issue, and network connection failures have 
>>>to "time out"
>>>before they fail.  Using a timed separate thread to obtain the 
>>>connections for the pool
>>>occurs to me; if the connection thread doesn't return in a certain 
>>>amount of time the
>>>parent thread could throw an Exception.
>>>
>>>Has anybody tired something along these lines?  Is this suggestion way 
>>>off base?
>>>
>>>Regards,
>>>Robert
>>>
>>>
>>>Bachler, Elisabeth (Elisabeth) wrote:
>>>
>>>>Hello,
>>>>I defined a database connection that uses a pool connection. 
>>>>Everything is
>>>>working well.
>>>>Now I had a routing problem that prevented any database connection 
>>>>(with a
>>>>SQPNestedException fired). The exception fired after a long time.... is
>>>>there a way of setting the connection limit, so it does not take so 
>>>>long
>>>>before firing the exception?
>>>>
>>>>Thanks
>>>>Elisabeth
>>>>
>>>>---------------------------------------------------------------------
>>>>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


______________________________________________
Justin Ruthenbeck
Software Engineer, NextEngine Inc.
justinr - AT - nextengine DOT com
Confidential. See:
http://www.nextengine.com/confidentiality.php
______________________________________________


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


Re: Limit time for Database connection

Posted by "Robert F. Hall" <rf...@berkeley.edu>.
Could be, anyone know for sure?

Eric Noel wrote:

> I thought it would be just as simple as setting the parameter in the 
> DBCP???
>
> <parameter>
>       <name>maxWait</name>
>       <value>10000</value>
> </parameter>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> On 7/9/2004 8:11 AM, Robert F. Hall wrote:
>
>> Elisabeth,
>>
>> Nobody has responded to your question (that I've seen), so I'll "take 
>> a shot".
>>
>> This sounds like a network issue, and network connection failures 
>> have to "time out"
>> before they fail.  Using a timed separate thread to obtain the 
>> connections for the pool
>> occurs to me; if the connection thread doesn't return in a certain 
>> amount of time the
>> parent thread could throw an Exception.
>>
>> Has anybody tired something along these lines?  Is this suggestion 
>> way off base?
>>
>> Regards,
>> Robert
>>
>>
>> Bachler, Elisabeth (Elisabeth) wrote:
>>
>>> Hello,
>>> I defined a database connection that uses a pool connection. 
>>> Everything is
>>> working well.
>>> Now I had a routing problem that prevented any database connection 
>>> (with a
>>> SQPNestedException fired). The exception fired after a long time.... is
>>> there a way of setting the connection limit, so it does not take so 
>>> long
>>> before firing the exception?
>>>
>>> Thanks
>>> Elisabeth
>>>
>>> ---------------------------------------------------------------------
>>> 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: Limit time for Database connection

Posted by Eric Noel <er...@mylife.ph>.
On 7/9/2004 8:11 AM, Robert F. Hall wrote:
> Elisabeth,
> 
> Nobody has responded to your question (that I've seen), so I'll "take a 
> shot".
> 
> This sounds like a network issue, and network connection failures have 
> to "time out"
> before they fail.  Using a timed separate thread to obtain the 
> connections for the pool
> occurs to me; if the connection thread doesn't return in a certain 
> amount of time the
> parent thread could throw an Exception.
> 
> Has anybody tired something along these lines?  Is this suggestion way 
> off base?
> 
> Regards,
> Robert
> 
> 
> Bachler, Elisabeth (Elisabeth) wrote:
> 
>> Hello,
>> I defined a database connection that uses a pool connection. 
>> Everything is
>> working well.
>> Now I had a routing problem that prevented any database connection 
>> (with a
>> SQPNestedException fired). The exception fired after a long time.... is
>> there a way of setting the connection limit, so it does not take so long
>> before firing the exception?
>>
>> Thanks
>> Elisabeth
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
I thought it would be just as simple as setting the parameter in the DBCP???

<parameter>
       <name>maxWait</name>
       <value>10000</value>
</parameter>

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


Re: Limit time for Database connection

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
Elisabeth,

Robert's suggestion should work, depending on the particulars of your 
situation.  Additional comments...

If the problem is happening at connection creation time (ie 
initialization of the webapp), you're much better off.  In this case, the 
network timeout isn't usually such a critical issue since someone is 
presumably monitoring the restart.

If, however, your pooled connection is bombing out during normal runtime, 
you've got more of a problem.  This situation is generally handled by the 
pool -- depending on which pool impl you're using, there will likely be a 
refresh rate which is the rate at which connections are tested for 
validity by the pool (seems like most people are using DBCP with Tomcat: 
see "testOnBorrow" and "testWhileIdle" parameters combined with 
"maxWait").  If you're concerned about requests to your app taking a long 
time because connections are no longer valid, this should significantly 
help and/or solve the problem.

If that's still not enough and you feel you still need a shorter timeout, 
remember that there are tradeoffs to shortening the timeout (it's there 
for a reason, after all).  That's going to be highly dependent on your 
pool impl and/or your database driver, depending on what you're 
using.  Change your timeout settings there. Either way I'd advise only 
going as low at the DB driver and not messing with OS networking settings 
if possible.

justin


At 05:11 PM 7/8/2004, you wrote:
>Elisabeth,
>
>Nobody has responded to your question (that I've seen), so I'll "take a 
>shot".
>
>This sounds like a network issue, and network connection failures have 
>to "time out"
>before they fail.  Using a timed separate thread to obtain the 
>connections for the pool
>occurs to me; if the connection thread doesn't return in a certain 
>amount of time the
>parent thread could throw an Exception.
>
>Has anybody tired something along these lines?  Is this suggestion way 
>off base?
>
>Regards,
>Robert
>
>
>Bachler, Elisabeth (Elisabeth) wrote:
>
>>Hello,
>>I defined a database connection that uses a pool connection. Everything 
>>is
>>working well.
>>Now I had a routing problem that prevented any database connection 
>>(with a
>>SQPNestedException fired). The exception fired after a long time.... is
>>there a way of setting the connection limit, so it does not take so long
>>before firing the exception?
>>
>>Thanks
>>Elisabeth
>>
>>---------------------------------------------------------------------
>>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


______________________________________________
Justin Ruthenbeck
Software Engineer, NextEngine Inc.
justinr - AT - nextengine DOT com
Confidential. See:
http://www.nextengine.com/confidentiality.php
______________________________________________


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


Re: Limit time for Database connection

Posted by "Robert F. Hall" <rf...@berkeley.edu>.
Elisabeth,

Nobody has responded to your question (that I've seen), so I'll "take a 
shot".

This sounds like a network issue, and network connection failures have 
to "time out"
before they fail.  Using a timed separate thread to obtain the 
connections for the pool
occurs to me; if the connection thread doesn't return in a certain 
amount of time the
parent thread could throw an Exception.

Has anybody tired something along these lines?  Is this suggestion way 
off base?

Regards,
Robert


Bachler, Elisabeth (Elisabeth) wrote:

>Hello,
>I defined a database connection that uses a pool connection. Everything is
>working well.
>Now I had a routing problem that prevented any database connection (with a
>SQPNestedException fired). The exception fired after a long time.... is
>there a way of setting the connection limit, so it does not take so long
>before firing the exception?
>
>Thanks
>Elisabeth
>
>---------------------------------------------------------------------
>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