How to anticipate (Oracle) database locks.
From: Jan Brunia <j.j.brunia_at_speed.a2000.nl>
Date: Sun, 18 May 2003 20:10:15 GMT
Message-ID: <HMRxa.409499$qm4.42554595_at_amsnews03.chello.com>
Hi,
}
Received on Sun May 18 2003 - 22:10:15 CEST
Date: Sun, 18 May 2003 20:10:15 GMT
Message-ID: <HMRxa.409499$qm4.42554595_at_amsnews03.chello.com>
Hi,
[Quoted] [Quoted] We have the problem of encountering database locks in our [Quoted] [Quoted] Java program. De piece of code most probably causing [Quoted] the lock is shown below.
[Quoted] Has anybody some advise concerning how to avoid the locks and when they happen how to handle them and remove them runtime?
Many thanks,
Jan
public void deleteByCustomerId(CustomerNr customerId)
throws MvpnException {
Database database = new Database(Bootstrap.getConfig(), "billing");
try {
[Quoted] [Quoted] database.setAutoCommit(false);
PreparedStatement preparedStatement =
database.prepareStatement(SQL_DELETE_VIRTUAL_MEMBERS);
preparedStatement.setString(1, customerId.toBilling());
preparedStatement.execute();
preparedStatement =
database.prepareStatement(SQL_DELETE_SUBSCRIBERS);
preparedStatement.setString(1, customerId.toBilling());
preparedStatement.execute();
preparedStatement =
database.prepareStatement(SQL_DELETE_CUSTOMER);
preparedStatement.setString(1, customerId.toBilling());
preparedStatement.execute();
database.commit();
} catch(SQLException e) {
try {
database.rollback();
} catch(SQLException e1) {
} finally {
log.error("sql error while storing parse result: ", e);
throw new MvpnException(e);
}
} finally {
database.close();
}
}
Received on Sun May 18 2003 - 22:10:15 CEST
