{"record":{"id":"87a506490fbc2773","repo":"pentaho/pentaho-kettle","slug":"database-exception-unabletodisableautocommit-i18n-unable-to","errorCode":null,"errorMessage":"Database.Exception.UnableToDisableAutoCommit (i18n: Unable to disable auto-commit on database connection {0})","messagePattern":"Database\\.Exception\\.UnableToDisableAutoCommit \\(i18n: Unable to disable auto-commit on database connection (.+?)\\)","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/Database.java","lineNumber":1084,"sourceCode":"      if ( log.isDebug() ) {\n        log.logDebug( \"Can't turn auto commit \" + onOff + Const.CR + Const.getStackTracker( e ) );\n      }\n    }\n  }\n\n  public void setCommitSize( int size ) {\n    commitsize = size;\n  }\n\n  public void setAutoCommit( boolean useAutoCommit ) throws KettleDatabaseException {\n    try {\n      connection.setAutoCommit( useAutoCommit );\n    } catch ( SQLException e ) {\n      if ( useAutoCommit ) {\n        throw new KettleDatabaseException( BaseMessages.getString(\n          PKG, \"Database.Exception.UnableToEnableAutoCommit\", toString() ) );\n      } else {\n        throw new KettleDatabaseException( BaseMessages.getString(\n          PKG, \"Database.Exception.UnableToDisableAutoCommit\", toString() ) );\n      }\n    }\n  }\n\n  /**\n   * Perform a commit the connection if this is supported by the database\n   */\n  public void commit() throws KettleDatabaseException {\n    commit( false );\n  }\n\n  public void commit( boolean force ) throws KettleDatabaseException {\n    try {\n      // Don't do the commit, wait until the end of the transformation.\n      // When the last database copy (opened counter) is about to be closed, we\n      // do a commit\n      // There is one catch, we need to catch the rollback","sourceCodeStart":1066,"sourceCodeEnd":1102,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/Database.java#L1066-L1102","documentation":"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.","triggerScenarios":"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.","commonSituations":"Beginning a manual transaction over a connection killed by the DB, drivers forbidding autocommit toggle with open cursors, connection pools enforcing autocommit=true.","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"],"exampleFix":"// before\ndatabase.setAutoCommit( false );\n// after\nif ( database.getConnection() != null && !database.getConnection().isClosed() ) {\n  database.setAutoCommit( false );\n} else {\n  database.connect();\n  database.setAutoCommit( false );\n}","handlingStrategy":"try-catch","validationCode":"Connection c = database.getConnection();\nif ( c == null || c.isClosed() ) {\n  database.connect();\n}","typeGuard":"boolean canStartTransaction( Database db ) throws SQLException {\n  Connection c = db.getConnection();\n  return c != null && !c.isClosed() && c.getAutoCommit();\n}","tryCatchPattern":"try {\n  database.setAutoCommit( false );\n} catch ( KettleDatabaseException e ) {\n  database.disconnect();\n  database.connect();\n  database.setAutoCommit( false );\n}","preventionTips":["Begin transactions immediately after connect, before other statements","Close open cursors before toggling autocommit","Confirm the pool/driver permits autocommit=false"],"tags":["jdbc","database","autocommit","transaction"],"backgroundTag":"invalid-state-transition","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}