setQueryTimeOut(1) - not expected result...
От
Guido Fiala
Тема
setQueryTimeOut(1) - not expected result...
Дата
Msg-id
200401281452.23064.guido.fiala@dka-gmbh.de
Список
Дерево обсуждения
setQueryTimeOut(1) - not expected result... Guido Fiala <guido.fiala@dka-gmbh.de>
Re: setQueryTimeOut(1) - not expected result... Oliver Jowett <oliver@opencloud.com>
Re: setQueryTimeOut(1) - not expected result... Guido Fiala <guido.fiala@dka-gmbh.de>
Re: setQueryTimeOut(1) - not expected result... Oliver Jowett <oliver@opencloud.com>
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
В списке pgsql-jdbc по дате отправления