Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
"Deadlock" is also known as "deadly-embrace".
This happens when:
pgma locks row1 in headertable
pgmb locks row33 in detailtable
pgma tries to lock row33 in detailtable but cannot and must wait as the row is already locked - (this is quite normal and happens often - the wait ends when pgmb releases control of detailtable/row33 and pgma continues).
NOW pgmb tries to lock row1 in headertable - it also cannot and must wait - which causes the deadlock. If the database engine does not terminate one of the requests (typically pgmb - the request that completed the deadlock), they will never end.
Your second questions was answered discussed (today) in the DB2 forum.