Subject | Record Locking |
---|---|
Author | Robert DiFalco |
Post date | 2003-05-14T16:56:15Z |
This may be more
appropriate for ib-support but I was wondering how one could atomically update a
range of records (that need individual SQL statements) using JDBC? I've seen the
"FOR UPDATE" method, but I couldn't find a lot of details on how it is used.
I.e. if you "don't" update the records how do you release the lock,
etc...
Basically, I have a
bunch of scheduled tasks that have an "isRunning" column. If there is a server
restart (or something like that) I want to lock all the records with aborted
"isRunning" states, update them to false, and then release all the locks. But I
want to perform the update one at a time instead of a single UPDATE WHERE
statement. I also want to know that records are already locked.
Is there any way to
do this sort of multi-user programming in SQL without having to resort to adding
extra fields to my tables that track transaction status?
Thanks in
advance!
R.