setQueryTimeOut(1) - not expected result...

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

Предыдущее
От: Guido Fiala
Дата:
Сообщение: Re: getting primary key values for inserted records?
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: getting primary key values for inserted records?