Hallo,
assuming one has 2 users which try to lock the same record for edit at a time
the one coming later should be informed of the situation, i like to do the
following:
//user1:
stmt.setQueryTimeout(1);//wait just one second
ResultSet rs=stmt.executeQuery("BEGIN;SELECT * FROM mytable FOR UPDATE OF
mytable");
//user2:
stmt.setQueryTimeout(1);
ResultSet rs=stmt.executeQuery("BEGIN;SELECT * FROM mytable FOR UPDATE OF
mytable");
(if timeoutinform user...)
I would think, that the second user get's a query timeout on his query, but it
does not seem to work. Instead the think seems to wait forever.
Immediately after user1 does and "COMMIT;" the user2 get's his ResultSet.
What am i doing wrong?
Guido