You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dunn, Rob" <rd...@tnsi.com> on 2013/03/13 08:49:49 UTC

No validationQueryTimeout in Tomcat7 tomcat-jdbc

Commons-dbcp 1.4 supports a validationQueryTimeout property.
The tomcat7 tomcat-jdbc connection pool (http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html) does not support this.
Has anyone found a way to configure a validation query timeout or achieve similar functionality  to commons-dbcp-1.4  in tomcat 7's tomcat-jdbc connection pool?

I note that there is a QueryTimeoutInterceptor, which appears to apply to all query timeouts, but I'd like to have the validationQueryTimeout much shorter than the normal query timeout.

Many thanks

Rob Dunn | Senior Software Engineer - Australia | Transaction Network Services
Level 21, 300 Adelaide Street | Brisbane QLD 4000 | Australia
Office +61.7.3224.9731 | Fax +61.7.3224.1785 | Mobile +61.415.860.282
e-mail rdunn@tnsi.com<ma...@tnsi.com> | http://www.tnsi.com<http://www.tnsi.com/>
This message and any attachments are for the sole use of each intended recipient and may contain copyright, confidential and/or privileged information of Transaction Network Services Inc or its related companies ("TNS"). Any unauthorised review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please immediately destroy all copies of the original message and let the sender know by reply e-mail. Unless otherwise expressly specified all views are those of the sender and not TNS.


Re: No validationQueryTimeout in Tomcat7 tomcat-jdbc

Posted by Daniel Mikusa <dm...@vmware.com>.
On Mar 13, 2013, at 1:50 PM, Daniel Mikusa wrote:

> On Mar 13, 2013, at 1:14 PM, Christopher Schultz wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>> 
>> Dan,
>> 
>> On 3/13/13 10:12 AM, Daniel Mikusa wrote:
>>> On Mar 13, 2013, at 3:49 AM, Dunn, Rob wrote:
>>> 
>>>> Commons-dbcp 1.4 supports a validationQueryTimeout property. The 
>>>> tomcat7 tomcat-jdbc connection pool 
>>>> (https://urldefense.proofpoint.com/v1/url?u=http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=8LKtd%2FtAZDTpwjGeWvVQiUwkyBqCv2FEneWpUZu8YLo%3D%0A&m=GVZLVYWRq7pdCsaexj2BhgF4WD6a2XE7cPmp2QLZqV8%3D%0A&s=88a37d5288d99be5827fb4f5996596f17c7c19d4b190a18d1cfd1f891ad3ec57)
>>>> 
>>>> 
>> does not support this.
>>> 
>>> Funny, I was just looking at the same thing yesterday.
>>> 
>>>> Has anyone found a way to configure a validation query timeout
>>>> or achieve similar functionality  to commons-dbcp-1.4  in tomcat
>>>> 7's tomcat-jdbc connection pool?
>>> 
>>> I couldn't find an option, like with DBCP, to do this.  My thought 
>>> was to write a custom connection validator and use 
>>> "validatorClassName" instead.  Not the cleanest approach since I
>>> have to re-implement the validation logic, but it'll let me set
>>> the timeout.
>> 
>> Seems like patching tomcat-pool would be a much easier solution. Care
>> to try your hand at a patch?
> 
> Agreed.  I'll give it a shot, seems simple enough.
> 
> Dan

Created...

https://issues.apache.org/bugzilla/show_bug.cgi?id=54693

...and attached an attempt at a patch.

Dan

> 
> 
>> 
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>> 
>> iEYEAREIAAYFAlFAtBAACgkQ9CaO5/Lv0PB4/wCfWfGXlEdAFXRRZpTEtGpVwMkF
>> gD0AoIeQB6z6ZsaS2YTpR5pqnve3cQ14
>> =GF1a
>> -----END PGP SIGNATURE-----
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

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


Re: No validationQueryTimeout in Tomcat7 tomcat-jdbc

Posted by Daniel Mikusa <dm...@vmware.com>.
On Mar 13, 2013, at 1:14 PM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Dan,
> 
> On 3/13/13 10:12 AM, Daniel Mikusa wrote:
>> On Mar 13, 2013, at 3:49 AM, Dunn, Rob wrote:
>> 
>>> Commons-dbcp 1.4 supports a validationQueryTimeout property. The 
>>> tomcat7 tomcat-jdbc connection pool 
>>> (https://urldefense.proofpoint.com/v1/url?u=http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=8LKtd%2FtAZDTpwjGeWvVQiUwkyBqCv2FEneWpUZu8YLo%3D%0A&m=GVZLVYWRq7pdCsaexj2BhgF4WD6a2XE7cPmp2QLZqV8%3D%0A&s=88a37d5288d99be5827fb4f5996596f17c7c19d4b190a18d1cfd1f891ad3ec57)
>>> 
>>> 
> does not support this.
>> 
>> Funny, I was just looking at the same thing yesterday.
>> 
>>> Has anyone found a way to configure a validation query timeout
>>> or achieve similar functionality  to commons-dbcp-1.4  in tomcat
>>> 7's tomcat-jdbc connection pool?
>> 
>> I couldn't find an option, like with DBCP, to do this.  My thought 
>> was to write a custom connection validator and use 
>> "validatorClassName" instead.  Not the cleanest approach since I
>> have to re-implement the validation logic, but it'll let me set
>> the timeout.
> 
> Seems like patching tomcat-pool would be a much easier solution. Care
> to try your hand at a patch?

Agreed.  I'll give it a shot, seems simple enough.

Dan


> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iEYEAREIAAYFAlFAtBAACgkQ9CaO5/Lv0PB4/wCfWfGXlEdAFXRRZpTEtGpVwMkF
> gD0AoIeQB6z6ZsaS2YTpR5pqnve3cQ14
> =GF1a
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

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


Re: No validationQueryTimeout in Tomcat7 tomcat-jdbc

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dan,

On 3/13/13 10:12 AM, Daniel Mikusa wrote:
> On Mar 13, 2013, at 3:49 AM, Dunn, Rob wrote:
> 
>> Commons-dbcp 1.4 supports a validationQueryTimeout property. The 
>> tomcat7 tomcat-jdbc connection pool 
>> (https://urldefense.proofpoint.com/v1/url?u=http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=8LKtd%2FtAZDTpwjGeWvVQiUwkyBqCv2FEneWpUZu8YLo%3D%0A&m=GVZLVYWRq7pdCsaexj2BhgF4WD6a2XE7cPmp2QLZqV8%3D%0A&s=88a37d5288d99be5827fb4f5996596f17c7c19d4b190a18d1cfd1f891ad3ec57)
>>
>> 
does not support this.
> 
> Funny, I was just looking at the same thing yesterday.
> 
>> Has anyone found a way to configure a validation query timeout
>> or achieve similar functionality  to commons-dbcp-1.4  in tomcat
>> 7's tomcat-jdbc connection pool?
> 
> I couldn't find an option, like with DBCP, to do this.  My thought 
> was to write a custom connection validator and use 
> "validatorClassName" instead.  Not the cleanest approach since I
> have to re-implement the validation logic, but it'll let me set
> the timeout.

Seems like patching tomcat-pool would be a much easier solution. Care
to try your hand at a patch?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlFAtBAACgkQ9CaO5/Lv0PB4/wCfWfGXlEdAFXRRZpTEtGpVwMkF
gD0AoIeQB6z6ZsaS2YTpR5pqnve3cQ14
=GF1a
-----END PGP SIGNATURE-----

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


Re: No validationQueryTimeout in Tomcat7 tomcat-jdbc

Posted by Daniel Mikusa <dm...@vmware.com>.
On Mar 13, 2013, at 3:49 AM, Dunn, Rob wrote:

> Commons-dbcp 1.4 supports a validationQueryTimeout property.
> The tomcat7 tomcat-jdbc connection pool (https://urldefense.proofpoint.com/v1/url?u=http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=8LKtd%2FtAZDTpwjGeWvVQiUwkyBqCv2FEneWpUZu8YLo%3D%0A&m=GVZLVYWRq7pdCsaexj2BhgF4WD6a2XE7cPmp2QLZqV8%3D%0A&s=88a37d5288d99be5827fb4f5996596f17c7c19d4b190a18d1cfd1f891ad3ec57) does not support this.

Funny, I was just looking at the same thing yesterday.

> Has anyone found a way to configure a validation query timeout or achieve similar functionality  to commons-dbcp-1.4  in tomcat 7's tomcat-jdbc connection pool?

I couldn't find an option, like with DBCP, to do this.  My thought was to write a custom connection validator and use "validatorClassName" instead.  Not the cleanest approach since I have to re-implement the validation logic, but it'll let me set the timeout.

> 
> I note that there is a QueryTimeoutInterceptor, which appears to apply to all query timeouts, but I'd like to have the validationQueryTimeout much shorter than the normal query timeout.

I agree with you here.  A separate timeout configuration would be nice.  I suppose you could subclass the QueryTimeoutInterceptor and add some logic to set different timeouts for different queries, but that seems like a hack.

Dan


> 
> Many thanks
> 
> Rob Dunn | Senior Software Engineer - Australia | Transaction Network Services
> Level 21, 300 Adelaide Street | Brisbane QLD 4000 | Australia
> Office +61.7.3224.9731 | Fax +61.7.3224.1785 | Mobile +61.415.860.282
> e-mail rdunn@tnsi.com<ma...@tnsi.com> | https://urldefense.proofpoint.com/v1/url?u=http://www.tnsi.com/&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=8LKtd%2FtAZDTpwjGeWvVQiUwkyBqCv2FEneWpUZu8YLo%3D%0A&m=GVZLVYWRq7pdCsaexj2BhgF4WD6a2XE7cPmp2QLZqV8%3D%0A&s=277d8546f65feae3cfdd546d8e5e47bf727be88ce6cbeb68ffbeba36074c9012<https://urldefense.proofpoint.com/v1/url?u=http://www.tnsi.com/&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=8LKtd%2FtAZDTpwjGeWvVQiUwkyBqCv2FEneWpUZu8YLo%3D%0A&m=GVZLVYWRq7pdCsaexj2BhgF4WD6a2XE7cPmp2QLZqV8%3D%0A&s=277d8546f65feae3cfdd546d8e5e47bf727be88ce6cbeb68ffbeba36074c9012>
> This message and any attachments are for the sole use of each intended recipient and may contain copyright, confidential and/or privileged information of Transaction Network Services Inc or its related companies ("TNS"). Any unauthorised review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please immediately destroy all copies of the original message and let the sender know by reply e-mail. Unless otherwise expressly specified all views are those of the sender and not TNS.
> 

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