| From: | Guido Fiala <guido(dot)fiala(at)dka-gmbh(dot)de> |
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | setQueryTimeOut(1) - not expected result... |
| Date: | 2004-01-28 13:52:23 |
| Message-ID: | 200401281452.23064.guido.fiala@dka-gmbh.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dennis Romero L. | 2004-01-28 13:58:44 | Re: connectivity problem |
| Previous Message | Guido Fiala | 2004-01-28 13:46:26 | Re: getting primary key values for inserted records? |