Re: HELP: Lock rows in Informix SE
Posted in 1997
In ver 5 SE or ONLINE, you may get locking error even if the row you are trying to update is not locked. There is something called adjacent row locking. E.g., if row A, B , C are in sequence, and you try to update B, we lock not only B, but A and C as well. We need to do that in the event of delete/insert to A or C. Maybe you can try some experiment and tell us if this is the problem you are hitting. There is no 'cure'. It is a design issue. Maybe you can set lock mode to wait, or move on to 7.X, which redesign this part of the code. Bryan Tonnet (batonnet@zeta.org.au) wrote: : In <34282B0B.82B@bloomberg.com> "Art S. Kagel" <kagel@bloomberg.com> writes: : : >It looks like you are being locked out of the row or page that you want : >to update. What is the table's LOCK MODE (select locklevel from : >systables where tabname = "mytable";)? If page mode (locklevel=="P") : >then change it to ROW level (alter table mytable set lock mode (row);). : >If this happens intermittently and most inserts/updates get through : >the problem could just be a concurrency problem. Try setting the : >application's LOCK MODE TO WAIT <nseconds>. : : I could be wrong here, but I think SE only has row level locking and : there's no locklevel field in systables. Don't pull your : hair out if you can't follow Art's (usually 110% correct) advice. : : Do however, check for LOCK TABLE statements, if this is what you mean : by the table being open. You may also like to make sure that your : program isn't doing something silly like; : : begin work : select every row in the table : update every row : pause for more input, allowing the user to go to lunch etc. : rollback/commit