5 pts.
 Records lock error
I keep getting a records lock error even after I change the setting to no records lock.

Software/Hardware used:
ASKED: September 14, 2010  10:33 AM
UPDATED: October 6, 2011  7:16 AM

Answer Wiki:
What do you mean, "change the setting to no records lock."? What language are you using? Give us some samples of the code. Phil
Last Wiki Answer Submitted:  September 14, 2010  11:01 am  by  philpl1jb   44,150 pts.
All Answer Wiki Contributors:  philpl1jb   44,150 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

You will get a ‘lock’ error if you try to update a record that is currently locked by another program. You cannot turn that off. You can read locked records; but if you later try to execute an update against that record, the lock in the other program will prevent DB2 from obtaining the lock for your program (which is beyond your control).

So, as Phil asked, what are you saying with “change the setting to no records lock”?

Tom

 107,995 pts.

 

You need a design level standard

Don’t lock the record.

Don’t ever write anything that locks a record – ever.

Except just before you update it.

read and display
read and display
decide an update is needed

read the record for update (lock)
check it hasn’t changed since you displayed it ( tell the user if so)
update it
release the lock

read and display
read and display
blahblah

 5,505 pts.