Subject Re: [Firebird-Java] Re: table lock
Author Nickolay Samofatov
Hello, Roman,

>> > I need to update a group of records and while i do that no one
>> > should read or update that group of record. The granularity of
>> > the operation should not be at record level but at group of
>> > records level. So i'm trying to acquire a table lock.
>>
>> Simply set transaction isolation level to TRANSACTION_SERIALIZABLE.

> And one more solution. Instead of making SELECT ... FROM ...
> WHERE ... FOR UPDATE (which does not work in FB 1.0) use UPDATE ...
> SET any_field = any_field WHERE ... This will lock your set of
> records without blocking the whole table. This method gives you
> better performance than TRANSACTION_SERIALIZABLE because it can also
> be used with TRANSACTION_REPEATABLE_READ and
> TRANSACTION_READ_COMMITTED.

But you should be aware that this method of locking records (dummy
updates) is very likely to generate "Update conflict" exception during
concurrent locking/updating.

Explicit locks in FB1.5 never produce update conflicts
in isc_tpb_read_committed+isc_tpb_wait modes.

Implicit and explicit record locks are not equivalent in Firebird

> Best regards,
> Roman Rokytskyy

Nickolay Samofatov