pentaho/pentaho-kettle · error · KettleDatabaseException
Database.Exception.UnableToEnableAutoCommit
Error message
Database.Exception.UnableToEnableAutoCommit (i18n: Unable to enable auto-commit on database connection {0}) What it means
i18n-keyed KettleDatabaseException (Database.Exception.UnableToEnableAutoCommit) thrown by Database.setAutoCommit(true) when Connection.setAutoCommit(true) throws a SQLException. It means the driver could not switch the connection into auto-commit mode, typically because the connection is broken or the transaction state is odd.
Solutions
- Verify the connection is still open; reconnect if it was dropped
- Commit or roll back and close open statements/result sets before toggling autocommit
- Check driver/pool constraints (some pools forbid changing autocommit per-connection)
- Retry setAutoCommit after reconnecting
Example fix
// before
database.setAutoCommit(true);
// after
if ( database.getConnection() != null && !database.getConnection().isClosed() ) {
database.setAutoCommit( true );
} else {
database.connect();
database.setAutoCommit( true );
} Defensive patterns
Strategy: try-catch
Validate before calling
Connection c = database.getConnection();
if ( c == null || c.isClosed() ) {
database.connect();
} Type guard
boolean canToggleAutoCommit( Database db ) throws SQLException {
Connection c = db.getConnection();
return c != null && !c.isClosed();
} Try / catch
try {
database.setAutoCommit( true );
} catch ( KettleDatabaseException e ) {
database.disconnect();
database.connect();
database.setAutoCommit( true );
} Prevention
- Close statements/result sets before switching autocommit
- Check pool settings that may forbid autocommit changes
- Validate connection liveness before transaction-mode changes
When it happens
Trigger: Calling Database.setAutoCommit(true) (directly or via commit paths) when connection.setAutoCommit(true) throws SQLException — dead/broken connection, active transaction the driver refuses to end, or driver limitation.
Common situations: Connection dropped by DB mid-transaction, driver that disallows toggling autocommit while a transaction/result set is open, XA or pooled connections with restricted autocommit control.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Database.Exception.UnableToDisableAutoCommit
- Database.Exception.UnableToReleaseSavepoint
- Database.Exception.UnableToRollbackToSavepoint
- Database.Exception.UnableToSetSavepoint
- Database.Exception.UnableToSetSavepointName
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/a9bc0a09c582d413.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:1081
log.logDetailed( "Auto commit " + onOff );
}
} catch ( Exception e ) {
if ( log.isDebug() ) {
log.logDebug( "Can't turn auto commit " + onOff + Const.CR + Const.getStackTracker( e ) );
}
}
}
public void setCommitSize( int size ) {
commitsize = size;
}
public void setAutoCommit( boolean useAutoCommit ) throws KettleDatabaseException {
try {
connection.setAutoCommit( useAutoCommit );
} catch ( SQLException e ) {
if ( useAutoCommit ) {
throw new KettleDatabaseException( BaseMessages.getString(
PKG, "Database.Exception.UnableToEnableAutoCommit", toString() ) );
} else {
throw new KettleDatabaseException( BaseMessages.getString(
PKG, "Database.Exception.UnableToDisableAutoCommit", toString() ) );
}
}
}
/**
* Perform a commit the connection if this is supported by the database
*/
public void commit() throws KettleDatabaseException {
commit( false );
}
public void commit( boolean force ) throws KettleDatabaseException {
try {
// Don't do the commit, wait until the end of the transformation.View on GitHub (pinned to f3058517a1)