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