"Matt Emmerton" <me******@nospam.yahoo.com> wrote in message
news:sY********************@rogers.com...
While this is correct, "LOCKSIZE ROW" is the default locking mode in DB2,
so
no extra steps are neccessary.
The problem that the OP is encountering are deadlocks, and there are only
two ways around this:
1) Use table locking (ALTER TABLE <table-name> LOCKSIZE TABLE), so that
only
one query can use the table at a time. This is not recommended!
2) Rewrite the application to avoid deadlock situations.
Matt
Locksize row is the default on DB2 for LUW, but not necessarily for other
platforms like z/OS, which only had page or tablespace locking for many
years, (except for the SQL lock table statement).
DB2 does not allow explicit locking of objects in SQL except for the lock
table statement. DB2 employs what is called pessimistic locking, whereby the
database locks for you based on the SQL statement issued, and releases locks
based on the isolation level and/or commit time.
As Matt noted, deadlocks can be cured by looking at the application SQL
code, and with a knowledge of how DB2 works with respect to locking, you can
almost always resolve the problem. It is a bit difficult for the totally
un-initiated to figure it out, but with a knowledgeable person it could be
figured out and you could get some skills transfer in the process.
The other option is to post in this forum all the exact DDL and all the
exact SQL of the offending applications involved in the deadlocks. The
deadlock event monitor will help identify some of the information you would
need to post.