re_ help lock record

From: bitrunner <bitrunner(at)katamail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: re_ help lock record
Date: 2006-05-24 12:28:35
Message-ID: 44745173.3080809@katamail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Dave wrote:

I think I understand the question. You want to know how to determine if
the record is locked.

As far as I know there isn't a way. If process A locks the record, then
process B attempts to lock the record it will block until process A
releases the record.

If you have statement_timeout set to some value other than -1 then
process B will timeout after waiting for the statement_timeout.
Otherwise it will block until process A is finished with the record.
------------------------------------------------------------------------
yes is my problem, you have understood perfectly!!!
I have already used the statement_timeout but it does not work: it does
not raise exception. This is my code:

conPostgre.transactionStart();
Statement stm = conPostgre.connection.createStatement();
stm.setQueryTimeout(3);
rs = stm.executeQuery("select * from prova where \"prvID\" = 1
for update");
System.out.println("Lock: " + rs.next());

I must set up of the parameters to postgresql.conf?

Thanks a lot.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2006-05-24 12:42:44 Re: re_ help lock record
Previous Message Dave Cramer 2006-05-24 11:31:35 Re: R: Help lock record