Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [JDBC] Implementing setQueryTimeout()

From: Till Toenges <tt(at)kyon.de>
Date: Tue Feb 19 2008 - 03:25:40 EST


Oliver Jowett wrote:
> setQueryTimeout() is documented as:
>

>> Sets the number of seconds the driver will wait for a Statement object 
>> to execute to the given number of seconds. If the limit is exceeded, 
>> an SQLException is thrown.

>
> That would seem to cover any sort of delay, not just "it is a slow query
> on the server side". If the Statement can't execute in N seconds, return
> an error. That could mean slow network - slow query - whatever.
>
> I don't see why clients that want timeouts care about the cause of the
> slowness - all they care about is that they get control back within
> some reasonable amount of time, surely? What's the use case where you
> would use setQueryTimeout() but don't actually mean "give me control
> back in N seconds"?

The documentation is unclear. But i think it is intended to limit the execution time on the server.

And i do care about the cause of the slowness. If i call setQueryTimeout(), i expect to be able to use the connection after a timeout, including everything i had SET before, prepared statements etc. A network timeout or anything worse is handled in an entirely different part of the code. That is not the responsibility of the driver, and doesn't event need to be part of the database related code at all.

Till

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq Received on Tue Feb 19 03:29:00 2008

This archive was generated by hypermail 2.1.8 : Wed Jun 18 2008 - 23:44:54 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library