pentaho/pentaho-kettle · error · KettleDatabaseException

Error comitting connection

Error message

Error comitting connection

What it means

KettleDatabaseException thrown by Database.commit() when connection.commit() throws an Exception AND databaseMeta.supportsEmptyTransactions() is true. Note the typo in the message ('comitting'). If the database does not support empty transactions, the exception is swallowed and only logged. Means the JDBC-level commit failed — the transaction was not persisted.

Solutions

  1. Inspect the wrapped cause for the DB-specific commit error (deadlock, constraint, connection lost)
  2. Roll back the failed transaction and retry it
  3. Verify the connection is still alive before commit; reconnect and re-execute the transaction if dropped
  4. Check for constraint violations in the data written during the transaction

Example fix

// before
database.commit();
// after
try {
  database.commit();
} catch ( KettleDatabaseException e ) {
  database.rollback();
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if ( database.getConnection() == null || database.getConnection().isClosed() ) {
  throw new IllegalStateException( "Cannot commit: connection closed" );
}

Type guard

boolean canCommit( Database db ) throws SQLException {
  Connection c = db.getConnection();
  return c != null && !c.isClosed() && !c.getAutoCommit();
}

Try / catch

try {
  database.commit();
} catch ( KettleDatabaseException e ) {
  try { database.rollback(); } catch ( Exception ignore ) {}
  throw new RuntimeException( "Commit failed: " + e.getCause().getMessage(), e );
}

Prevention

When it happens

Trigger: Calling Database.commit() with an active connection where connection.commit() throws — constraint violation deferred to commit, deadlock victim, connection lost mid-transaction, or commit on a read-only connection.

Common situations: Deferred FK/unique constraint failures at commit time, network drop during transaction, deadlock/timeout on commit, committing on an autocommit-only or read-only connection.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/1b1bb3ae4ced7fd3. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:1122

      // The flag is in "performRollback", private only
      //
      if ( !Utils.isEmpty( connectionGroup ) && !force ) {
        return;
      }
      if ( getDatabaseMetaData().supportsTransactions() ) {
        if ( log.isDebug() ) {
          log.logDebug( "Commit on database connection [" + toString() + "]" );
        }
        connection.commit();
        nrExecutedCommits++;
      } else {
        if ( log.isDetailed() ) {
          log.logDetailed( "No commit possible on database connection [" + toString() + "]" );
        }
      }
    } catch ( Exception e ) {
      if ( databaseMeta.supportsEmptyTransactions() ) {
        throw new KettleDatabaseException( "Error comitting connection", e );
      }
    }
  }

  /**
   * This methods may be removed in future.
   *
   * @param logTable
   * @throws KettleDatabaseException
   */
  public void commitLog( LogTableCoreInterface logTable ) throws KettleDatabaseException {
    this.commitLog( false, logTable );
  }

  /**
   * This methods may be removed in future.
   *
   * @param force

View on GitHub (pinned to f3058517a1)