pentaho/pentaho-kettle · error · KettleDependencyException

This database is still in use by N jobs and M…

Error message

This database is still in use by N jobs and M transformations references

What it means

A KettleDependencyException thrown by delDatabase when the database connection being deleted is still referenced by jobs and/or transformations in the repository. The message counts the referencing jobs and transformations and attaches a detailed exception listing every dependent by name, so the delete is refused to preserve referential integrity.

Solutions

  1. Open the dependent jobs/transformations listed in the cause message and re-point or remove their database usage
  2. Re-save those jobs/transformations, then retry the delete
  3. If the references are stale/orphan rows, clean the association tables manually after backing up the repository
  4. Delete or archive the dependent jobs/transformations if they are no longer needed

Example fix

// before
repository.deleteDatabaseMeta("SharedConn"); // throws dependency exception
// after: re-point dependents first
for (String trans : dependentTransformations) {
  // load each transformation, change its DB connection, re-save
}
repository.deleteDatabaseMeta("SharedConn");
Defensive patterns

Strategy: validation

Validate before calling

// check references before deleting a connection
ResultSet rs = stmt.executeQuery(
  "SELECT COUNT(*) FROM R_JOB_ATTRIBUTE WHERE CODE='DATABASE_NAME' AND VALUE_STR='SharedConn'");

Try / catch

try {
  repository.deleteDatabaseMeta(name);
} catch (KettleDependencyException e) {
  // parse dependent job/transformation names from e.getMessage() and re-point them first
}

Prevention

When it happens

Trigger: Calling delDatabase(id_database) (via deleteDatabaseMeta) while rows in the job/transformation database-association tables still reference the connection id.

Common situations: Removing a shared database connection still used by scheduled jobs; cleaning up unused connections without first checking usage; after importing content that references the connection.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryDatabaseDelegate.java:386

    if ( jobList.length == 0 && transList.length == 0 ) {
      repository.connectionDelegate.performDelete( "DELETE FROM "
        + quoteTable( KettleDatabaseRepository.TABLE_R_DATABASE ) + " WHERE "
        + quote( KettleDatabaseRepository.FIELD_DATABASE_ID_DATABASE ) + " = ? ", id_database );
    } else {
      String message = " Database used by the following " + Const.CR;
      if ( jobList.length > 0 ) {
        message = "jobs :" + Const.CR;
        for ( String job : jobList ) {
          message += "\t " + job + Const.CR;
        }
      }

      message += "transformations:" + Const.CR;
      for ( String trans : transList ) {
        message += "\t " + trans + Const.CR;
      }
      KettleDependencyException e = new KettleDependencyException( message );
      throw new KettleDependencyException( "This database is still in use by "
        + jobList.length + " jobs and " + transList.length + " transformations references", e );
    }
  }

  public synchronized void delDatabaseAttributes( ObjectId id_database ) throws KettleException {
    repository.connectionDelegate.performDelete( "DELETE FROM "
      + quoteTable( KettleDatabaseRepository.TABLE_R_DATABASE_ATTRIBUTE ) + " WHERE "
      + quote( KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_ID_DATABASE ) + " = ? ", id_database );
  }

  public synchronized int getNrDatabases() throws KettleException {
    int retval = 0;

    String sql = "SELECT COUNT(*) FROM " + quoteTable( KettleDatabaseRepository.TABLE_R_DATABASE );
    RowMetaAndData r = repository.connectionDelegate.getOneRow( sql );
    if ( r != null ) {
      retval = (int) r.getInteger( 0, 0L );
    }

View on GitHub (pinned to f3058517a1)