Lesson 9 | Alternative concurrency mechanisms for Web applications |
Objective | Implement alternative locking for a Web application |
Alternative Concurrency Mechanisms
Tuning techniques to replace the Oracle locking scheme
There are several reasons, described in the previous lesson, to consider
alternatives to shared and exclusive locks. There are two common tuning techniques that are used to replace the Oracle locking scheme. The first is to issue all updates with a WHERE clause.
Update with a WHERE clause
Let's look at an example of this in the Slide Show below.
- Gould's row contains the performance_flag, salary and name column.
- The UPDATE required is sent with a WHERE clause.
- Each of the columns, are specified in the update command to ensure that they have not changed since the transaction began.
- This re-validates all of the existing new values from the original display.
- If any of these values have changed since the row was initially retrieved, Oracle willl reject the transaction, not perform the update, and will return a non-zero error status.
- The database will return with a NOT FOUND SQL code.
Update Where Statement
Note: As a further enhancement, the WebServer application can interpret the NOT FOUND error code returned after this transaction, re-retrieve the updated record, and present it to the user with its new value.
The next lesson discusses date time stamp.