Subject Re: I need some help with Transactions
Author Roman Rokytskyy <>
> Our problem is that QueryTimeout isn't working (DOC: do nothing)
> and we neither know how to make that instead of "deadlock" we get
> an SQLExcetion or something similar.

Neither query timeout nor query cancelling are supported by server.

> We readed that setting TransactionIsolation to
> TRANSACTION_REPEATABLE_READ will trow it, but didn't work.

You need to provide custom TPB (Transaction Parameter Buffer)
mapping. When there is a lock conflict, Firebird checks the TPB is it
contains isc_tpb_wait or isc_tpb_nowait. In former case server will
wait until the lock is released. In latter case it will throw an
exception about lock conflict. isc_tpb_wait is a default value.

If you are 100% sure that your application design is correct and
getting an exception in case of lock conflict is what you want, you
must specify your custom TPB mapping in connection parameters:

Properties props = new Properties();
props.setProperty("user", "SYSDBA");
props.setProperty("password", "masterkey");
//.. here you can specify mapping for other tx isolation levels

Connection con = DriverManager.getConnection(url, props);

Or you can include this mapping in URL as following:

But again, check first if everything is correct with your application
design. Deadlock is very often sign that something is wrong.

Best regards,
Roman Rokytskyy