pentaho/pentaho-kettle · error · KettleDatabaseException
Database.Exception.UnableToDisableAutoCommit
Error message
Database.Exception.UnableToDisableAutoCommit (i18n: Unable to disable auto-commit on database connection {0}) What it means
i18n-keyed KettleDatabaseException (Database.Exception.UnableToDisableAutoCommit) thrown by Database.setAutoCommit(false) when Connection.setAutoCommit(false) throws a SQLException. Thrown when the driver cannot start manual-transaction mode — usually a broken connection or driver/pool restriction. Required before manual commit/rollback can work.
Solutions
- Reconnect if the connection is closed/broken, then retry setAutoCommit(false)
- Close open statements/result sets before changing autocommit mode
- Check pool configuration that may lock autocommit to true
- Verify driver support for manual transaction mode
Example fix
// before
database.setAutoCommit( false );
// after
if ( database.getConnection() != null && !database.getConnection().isClosed() ) {
database.setAutoCommit( false );
} else {
database.connect();
database.setAutoCommit( false );
} Defensive patterns
Strategy: try-catch
Validate before calling
Connection c = database.getConnection();
if ( c == null || c.isClosed() ) {
database.connect();
} Type guard
boolean canStartTransaction( Database db ) throws SQLException {
Connection c = db.getConnection();
return c != null && !c.isClosed() && c.getAutoCommit();
} Try / catch
try {
database.setAutoCommit( false );
} catch ( KettleDatabaseException e ) {
database.disconnect();
database.connect();
database.setAutoCommit( false );
} Prevention
- Begin transactions immediately after connect, before other statements
- Close open cursors before toggling autocommit
- Confirm the pool/driver permits autocommit=false
When it happens
Trigger: Calling Database.setAutoCommit(false) when connection.setAutoCommit(false) throws SQLException — dead connection, open result sets/transactions the driver won't allow transitioning from, or restricted pooled/XA connections.
Common situations: Beginning a manual transaction over a connection killed by the DB, drivers forbidding autocommit toggle with open cursors, connection pools enforcing autocommit=true.
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.UnableToEnableAutoCommit
- 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/87a506490fbc2773.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:1084
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.
// When the last database copy (opened counter) is about to be closed, we
// do a commit
// There is one catch, we need to catch the rollbackView on GitHub (pinned to f3058517a1)