-
1. Re: Oracle transaction isolation
rmahal Dec 20, 2002 3:43 AM (in response to imdkidd)My understanding is that transaction isolation is not a deployment attribute for ORACLE. In the past I've needed a snapshot read when extracting data. To achieve this I've had to issue "SET TRANSACTION READONLY" manually once I've connected to the database. I hope this helps.
Some code ....
public static void setTransactionIsolationRepeatableRead(DataSource dataSource)
throws GeneralPersistenceException {
// Getting connection
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = dataSource.getConnection();
// Oracle/jdbc doesn't support this!!!!
// connection.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
// Therefore doing it manually
preparedStatement = connection.prepareStatement("set transaction read only");
preparedStatement.executeUpdate();
cat.debug("Set transaction read only as TRANSACTION_REPEATABLE_READ is not supported!");
}
catch(SQLException sqle) {
cat.fatal("Unable to get database connection/set isolation level: " + dataSource + " " + sqle.getMessage());
throw new GeneralPersistenceException("Unable to get database connection/set isolation level: " + dataSource, sqle);
}
closeDatabaseResource(preparedStatement,connection);
}