Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  Data Consistency →  Database Locks 

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 cl_db_sys=>dbsys_type = 'DB2'. 
  CALL FUNCTION 'DB_COMMIT'. 
ENDIF.

We recommend that these database commits are used in programs with extremely long read operations.

Other versions: 7.31 | 7.40 | 7.54