Locking

From: "Sacauskis, Mike" <Mike(dot)Sacauskis(at)gdit(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Locking
Date: 2008-04-19 00:09:14
Message-ID: 0F35BAEA672CA340974082D0348491E603954717@HQ-EXVS03.anteon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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?

String sql = "select * from testtable";

PreparedStatement prest = con.prepareStatement(sql);

ResultSet rs = prest.executeQuery();

rs.next();

rs.close();

prest.close();

con.close();

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jan de Visser 2008-04-19 00:34:44 Re: Locking
Previous Message Pinki 2008-04-18 12:50:35 Re: Problem establishing connection