Hi.
Given the following:
----------------
String lockSubscriptionQuery =
"SELECT subscriptionId FROM subscription WHERE subscriptionId = ?
FOR UPDATE";
pStmt = conn.prepareStatement(lockSubscriptionQuery);
pStmt.setLong(1, a_Conference.getSubscriptionId());
SqlHelper.executePreparedQuery(pStmt);
pStmt.close();
-----------------
Q1: Will the last close() release the pessimistic lock?
Q2: My understanding was that SELECT...for UPDATE got a pessimistic
lock. But my tests show I need to UPDATE the row just after to get the
lock.
Q: Should we close the statement later if we want to hold the lock for
longer?
The following URL
http://java.sun.com/j2se/1.4.2/docs/...nt.html#close()
Says "Releases this Statement object's database and JDBC resources
immediately...."
Wondering what DB2 will do. How to get a pessimistic lock? etc....
Any help would be greatly appreciated. Thanks.
Joel