Article
Lock Conflicts in IBM DB2
On DB2 for i5/OS , locks are not only set for modifying
transactions , but also for consistent
reads on buffered tables, cluster
tables, and pooled tables . The isolation
level "read stability" is used for this purpose in the database
system, using "shared locks" , which prevent table contents from
being modified simultaneously.
Besides timeouts and deadlocks
lock conflicts can also cause errors with DDL
( data definition language ) commands such as CREATE
, ALTER , and DROP , and slow down online
reorganization.
The statement OPEN CURSOR with the WITH HOLD option can
be used to persist the position of a cursor beyond the commit event, if
necessary.
To avoid lock conflicts, commits should be executed as
database commits . The following
function module can be used for this:
IF sy-dbsys = 'DB2'.
CALL FUNCTION 'DB_COMMIT'.
ENDIF.
We recommend that these database commits are used in programs with
extremely long read operations.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved