Locking behaviour

Previous Next

When a request is made to lock a record but the record is already locked by another process, the behaviour of USoft can be influenced in two ways:.

1.By default, the lock timeout on SQL Server and Sybase is 10 seconds: the Rules Engine waits for a maximum of 10 seconds when requesting a record that is already locked.

This timeout can be changed by adding the following resource setting to the command line, using the -xrm option:

   -xrm "*OledbLogin.timeout:60"

or

   -xrm "*timeout:60"

In this instance, the result is a timeout of 60 seconds.

Increasing the timeout has the advantage that timeout error messages do not appear too soon, and stop the transaction too soon. A disadvantage is that too long a timeout may cause a user to wait too long for a locked record.

2.When running against Oracle, a Select statement can be executed to retrieve and lock records by using the "FOR UPDATE OF" clause.
Select statements with a "FOR UPDATE OF" clause, can be directed to skip records which are already locked, without giving an error, using the "SKIP LOCKED" clause.
 
Syntax

 SELECT column FROM table FOR UPDATE OF column SKIP LOCKED