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();