Re: Locking in Exclusive mode is not working as I thought!!!
Posted in 1999
Mild
You may want to try setting the ISOLATION LEVEL for the session to REPEATABLE
READ to get the kind of behavior you want. I think you are using the COMMITTED
READ ISOLATION LEVEL which is the default and that behaves in exactly the way
you describe.
HTH
Sujit
Mild <theronk@sprynet.com> on 09/10/99 09:41:49 AM
Please respond to Mild <theronk@sprynet.com>
To: informix-list@iiug.org
cc: (bcc: Sujit Pal)
Subject: Locking in Exclusive mode is not working as I thought!!!
Hi all:
I am working on an JDBC/Informix application in Java and maybe you gurus can
help me out, there's a table called "sys_info" that has 1 row that
contains a control-number to be the next ticket number used.
The idea is for me to be able to lock that table in exclusive mode (so
nobody else can read it(doing a select should result in an error))
and then update the control number by adding 1 to
it and then unlocking the table...
I ran a little test in 2 windows using dbaccess
Window 1 Window 2
"lock table sys_info in exclusive mode" select * from sys_info
I expected Window 2 to give me an error "Table is locked".
Instead, it allowed me to select the row (which is not what I want it to
do). It won't allow me to update it though (which is what I expected) as I
get the table locked message.
I thought that when you have a table locked in exclusive mode, nobody would
even be able to read it... I am trying to get just that same exact
behavior.
Please help :-)
Theron