Oracle table lock
Hi,
privatestatic String SQL_UPDATE =
"UPDATE ACCT_TRANSACTION " +
"SET " +
" ATTEMPT = ?, " +
" OUTCOME = ?, " +
" QUEUED = ?, " +
" RESULT1 = 'Cxvya', " +
" RESULT2 = ?, " +
" CALL_START_TIME = ?, " +
" DATE_MODIFIED = SYSDATE " +
"WHERE ACCT_TRANSACTION_ID = ? " ;
conn = DAOFactory.getConnection();
PreparedStatement pstmt = conn.prepareStatement(CallDAO.SQL_UPDATE);
pstmt.setQueryTimeout(30);
pstmt.setInt(1, call.getAttempts());
pstmt.setString(2, call.getOutcome());
pstmt.setInt(3, call.getQueued());
pstmt.setString(4, call.getResult2());
pstmt.setTimestamp(5, call.getCallStartTime());
pstmt.setString(6, call.getAcctTransactionId());
if(pstmt.getUpdateCount() != -1){
pstmt.close();
conn.commit() ;
}else{
pstmt.close();
conn.rollback();
}
Ive run into a situation where there is a lock on the table, and my code needs to realise there is a lock and take move on. pstm.setQueryTimeOut(30); does'nt seem to work right.
The above snippet checking the updateCount() although not tested, sounded like a good idea. Right now the threads hang when there is a lock on the table. Any other ideas, how I can realise there is a lock and timeout, or throw an exception using prepared statements, or any other method?

