Example #1
0
 protected Connection getConnection(Log statementLog) throws SQLException {
   Connection connection = transaction.getConnection();
   if (statementLog.isDebugEnabled() || connectionLog.isDebugEnabled()) {
     return ConnectionLogger.newInstance(connection, statementLog);
   } else {
     return connection;
   }
 }
Example #2
0
 private void init() throws SQLException, TransactionException {
   // Open JDBC Transaction
   Connection connection = dataSource.getConnection();
   connection = ConnectionLogger.newInstance(connection);
   if (connection == null) {
     throw new TransactionException(
         "JdbcTransaction could not start transaction.  Cause: The DataSource returned a null connection.");
   }
   // Isolation Level
   isolationLevel.applyIsolationLevel(connection);
   // AutoCommit
   if (connection.getAutoCommit()) {
     connection.setAutoCommit(false);
   }
   executor =
       configuration.newExecutor(
           new org.apache.ibatis.transaction.jdbc.JdbcTransaction(connection, false));
 }