{"record":{"id":"21c8af8867176463","repo":"pentaho/pentaho-kettle","slug":"database-exception-unabletosetsavepoint","errorCode":null,"errorMessage":"Database.Exception.UnableToSetSavepoint","messagePattern":"Database\\.Exception\\.UnableToSetSavepoint","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/Database.java","lineNumber":5088,"sourceCode":"              break;\n            default:\n              ins.append( fields.getString( r, i ) );\n              break;\n          }\n        }\n      }\n      ins.append( ')' );\n    } catch ( Exception e ) {\n      throw new KettleDatabaseException( e );\n    }\n    return ins.toString();\n  }\n\n  public Savepoint setSavepoint() throws KettleDatabaseException {\n    try {\n      return connection.setSavepoint();\n    } catch ( SQLException e ) {\n      throw new KettleDatabaseException(\n        BaseMessages.getString( PKG, \"Database.Exception.UnableToSetSavepoint\" ), e );\n    }\n  }\n\n  public Savepoint setSavepoint( String savePointName ) throws KettleDatabaseException {\n    try {\n      return connection.setSavepoint( savePointName );\n    } catch ( SQLException e ) {\n      throw new KettleDatabaseException( BaseMessages.getString(\n        PKG, \"Database.Exception.UnableToSetSavepointName\", savePointName ), e );\n    }\n  }\n\n  public void releaseSavepoint( Savepoint savepoint ) throws KettleDatabaseException {\n    try {\n      connection.releaseSavepoint( savepoint );\n    } catch ( SQLException e ) {\n      throw new KettleDatabaseException( BaseMessages.getString(","sourceCodeStart":5070,"sourceCodeEnd":5106,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/Database.java#L5070-L5106","documentation":"Thrown by Database.setSavepoint() (Database.java:5088) when connection.setSavepoint() fails with a SQLException. JDBC savepoints require an active transaction with auto-commit disabled, and not all drivers support them.","triggerScenarios":"Calling Database.setSavepoint() while autoCommit is still true, the connection is closed, or the JDBC driver does not support savepoints (throws SQLFeatureNotSupportedException).","commonSituations":"Forgetting setAutoCommit(false) before setSavepoint; using drivers/databases without savepoint support (e.g. older MySQL/MyISAM tables); calling savepoint APIs after the connection has been dropped.","solutions":["Call Database.setAutoCommit(false) before requesting a savepoint","Verify the connection is open and valid (checkDatabaseException/connected state)","Confirm the target database and driver support savepoints (JDBC 3.0+, transactional tables)","Check supportsSavepoints() on the DatabaseMeta before using savepoint logic","Inspect the wrapped SQLException cause for feature-not-supported vs connection errors"],"exampleFix":"// before\nSavepoint sp = database.setSavepoint();\n// after\nif ( database.getDatabaseMeta().supportsSavepoints() ) {\n  database.setAutoCommit( false );\n  Savepoint sp = database.setSavepoint();\n}","handlingStrategy":"validation","validationCode":"if ( !databaseMeta.supportsSavepoints() ) {\n  throw new IllegalStateException( \"Savepoints not supported by \" + databaseMeta.getPluginName() );\n}\ndatabase.setAutoCommit( false );","typeGuard":null,"tryCatchPattern":"try {\n  savepoint = database.setSavepoint();\n} catch ( KettleDatabaseException e ) {\n  SQLException sqle = (SQLException) e.getCause();\n  if ( sqle instanceof SQLFeatureNotSupportedException ) {\n    // fall back to full transaction without savepoints\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always disable auto-commit before setSavepoint","Check DatabaseMeta.supportsSavepoints() first","Keep the connection alive across the savepoint lifecycle","Avoid savepoints on non-transactional storage engines"],"tags":["jdbc","database","transaction","savepoint"],"backgroundTag":"database-query-failed","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"}