Обсуждение: Re: [BUGS] BUG #1459: Connection hangs when other connection is not

Поиск
Список
Период
Сортировка

Re: [BUGS] BUG #1459: Connection hangs when other connection is not

От
Oliver Jowett
Дата:
Peter Eisentraut wrote:
> Am Freitag, 4. Februar 2005 11:54 schrieb Rainer Frey:
>
>>Is there any possibility to set a timeout for the lock, after which the
>>ALTER TABLE statement fails, instead of remaining in wait status (when
>>calling with JDBC?
>
> Yes, there is a statement_timeout parameter or something like that.

JDBC has a couple of mechanisms that may be more portable than fiddling
with statement_timeout directly:

- Statement.setQueryTimeout(). This is *not* implemented by the current
driver (it is a no-op), but shouldn't be too hard to implement as
mapping to statement_timeout if you feel inclined to do some driver hacking.

- Statement.cancel(). This is implemented by the current driver, but you
will need to build your own infrastructure to handle doing the cancel
from a separate thread if a query takes too long.

-O

Re: [BUGS] BUG #1459: Connection hangs when other connection is not

От
Kris Jurka
Дата:

On Sat, 5 Feb 2005, Oliver Jowett wrote:

> - Statement.setQueryTimeout(). This is *not* implemented by the current
> driver (it is a no-op), but shouldn't be too hard to implement as
> mapping to statement_timeout if you feel inclined to do some driver hacking.
>

I think it will be complicated on the error handling/cleanup side,
especially with a multithreaded application.  You set it, you execute a
statement, and then you've got to reset it back to the default so other
threads aren't affected by it.

Kris Jurka