Re: Locking

From: "Jan de Visser" <jdevisser(at)digitalfairway(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Locking
Date: 2008-04-19 00:34:44
Message-ID: 1159c1e90804181734u61dc442cie41eaf38fcc8a20b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Doh. Forgot to copy list.

On Fri, Apr 18, 2008 at 8:33 PM, Jan de Visser <jdevisser(at)commsolv(dot)com> wrote:
> On Fri, Apr 18, 2008 at 8:09 PM, Sacauskis, Mike
> <Mike(dot)Sacauskis(at)gdit(dot)com> wrote:
> >
> > I'm running into a problem where an "AccessShareLock" is not being released
> > after a select statement unless a connection is closed. This is leading me
> > to a deadlock issue with deletes. I'm using JDBC to interact with the
> > database. I'm using postgresQL 8.0. I was under the impression that
> > resources (does this include locks) are released when the prepared statement
> > is closed. The code snippet looks like the following (though it does more
> > prosessing then in this example. Is there something that I'm missing to
> > release the locks?
>
> Locks get released when the transaction which holds them commits/rolls back.
>
> I assume you are running with autocommit off. If you want your locks
> to be relinquished, you need to call con.commit() at the time you want
> them relinquished.
>
> Or you can just turn autocommit on. In that case you get more or less
> the behaviour you expected, since every statement will run in its own
> transaction which commits on completion of the statement (which is
> even before you start reading from the resultset).
>
> jan
>

In response to

  • Locking at 2008-04-19 00:09:14 from Sacauskis, Mike

Browse pgsql-jdbc by date

  From Date Subject
Next Message ab.spamnews 2008-04-21 07:44:06 Updated 8.0 translation (German)
Previous Message Sacauskis, Mike 2008-04-19 00:09:14 Locking