RE: Locked record
Posted in 1998
Topics: Stored Procedures & SPL, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Transactions, Locking & Isolation
Marek -
In addition to the great ideas given by Richard - I would like to add one
other possible solution. If you cannot avoid the lock error through any of
the mentioned methods, you can also 'trap' for the error so the program
doesn't crash. You could set 'Whenever any error continue' then after your
insert/select/update you could check the sqlca.sqlcode for any of the known
lock errors (-243,-244,-245,-246,-250). If a lock is encountered you can
manually retry or report to the user that the record is locked and ask if
they wish to continue or cancel.
Sometimes lock conditions just cannot be avoided, but you can keep the
program from crashing.
Derek M. Sleeper
Management Information Consulting
<mailto:dsleeper@micinc.com> dsleeper@micinc.com /
<mailto:iidqs@brightpoint.com> iidqs@brightpoint.com
-----Original Message-----
From: Richard Thomas [SMTP:Richard.Thomas@yes.optus.com.au]
Sent: Thursday, August 27, 1998 6:08 AM
To: informix-list@iiug.org; 'Marek Miloszewski'
Subject: RE: Locked record
Marek,
Try putting a SET LOCK MODE TO WAIT n ; statement in the 4GL. The
problem is that the index-row (and the row itself) is locked for the
term of the transaction that your second user is performing. If the
4GL
doesn't do any updating, (ie if it's just a report), try adding a
SET
ISOLATION TO DIRTY READ to it (if that isolation level is
appropriate to
your application).
You could also try changing the LOCK MODE of the offending table to
ROW,
but I don't think that is your problem here. It looks to me like
the
index is being read by the 4GL, and crashing when it encounters a
lock
held by another user.
cheers
RET
> ----------
> From: Marek Miloszewski
> Sent: Thursday, 27 August 1998 6:39 PM
> To: informix-list@iiug.org
> Subject: Locked record
>
> Hi all,
>
> we have a problem with one of our application. Sometimes when
somebody
> is
> inserting new record into one of the tables, other person has a
> problem with
> entering the application. Here is a message displayed:
>
> Program stopped at "function.4gl", line number 166.
> SQL statement error number -244.
> Could not do a physical-order read to fetch next row.
> SYSTEM error number -107.
> ISAM error: record is locked. >
> The problem is that it does not happened continuously. One day
yes,
> another
> not. Our application producer said this is problem with our
Informix
> configuration. But other programs work properly! I don't know were
to
> look
> for error...
>
> Any suggestions?
>
> Marek
>
> -------------------------------------------------------------
> Zaklad Energetyczny Szczecin SA
> ul. Malczewskiego 5/7, 70-952 Szczecin, Poland
> tel: (48 91) 424.00.71 w.5216, fax: (48 91) 22.56.28
> marek.miloszewski@zes.szczecin.pl
> -------------------------------------------------------------
> memorek@polbox.com
> http://www.polbox.com/m/memorek
> -------------------------------------------------------------
>