try {
_connection = ConnectionFactory.getConnection(helperName);
if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:connection() : manualTx=" + _manualTX, module);
} catch (SQLException sqle) {
throw new GenericDataSourceException("Unable to esablish a connection with the database.", sqle);
}
// make sure we actually did get a connection
if (_connection == null) {
throw new GenericDataSourceException("Unable to esablish a connection with the database. Connection was null!");
}
// test the connection
testConnection(_connection);
/* causes problems w/ postgres ??
if (Debug.verboseOn()) {
int isoLevel = -999;
try {
isoLevel = _connection.getTransactionIsolation();
} catch (SQLException e) {
Debug.logError(e, "Problems getting the connection's isolation level", module);
}
if (isoLevel == Connection.TRANSACTION_NONE) {
Debug.logVerbose("Transaction isolation level set to 'None'.", module);
} else if (isoLevel == Connection.TRANSACTION_READ_COMMITTED) {
Debug.logVerbose("Transaction isolation level set to 'ReadCommited'.", module);
} else if (isoLevel == Connection.TRANSACTION_READ_UNCOMMITTED) {
Debug.logVerbose("Transaction isolation level set to 'ReadUncommitted'.", module);
} else if (isoLevel == Connection.TRANSACTION_REPEATABLE_READ) {
Debug.logVerbose("Transaction isolation level set to 'RepeatableRead'.", module);
} else if (isoLevel == Connection.TRANSACTION_SERIALIZABLE) {
Debug.logVerbose("Transaction isolation level set to 'Serializable'.", module);
}
}
*/
// always try to set auto commit to false, but if we can't then later on we won't commit
try {
if (_connection.getAutoCommit()) {
try {
_connection.setAutoCommit(false);
if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:setAutoCommit(false) : manualTx=" + _manualTX, module);
} catch (SQLException sqle) {
_manualTX = false;
}
}
} catch (SQLException e) {
throw new GenericDataSourceException("Cannot get autoCommit status from connection", e);
}
try {
if (TransactionUtil.getStatus() == TransactionUtil.STATUS_ACTIVE) {
if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.getConnection] : active transaction", module);