pentaho/pentaho-kettle · error · KettleException

KettleDatabaseRepository.Exception.ErrorDeletingConnection.M…

Error message

KettleDatabaseRepository.Exception.ErrorDeletingConnection.Message

What it means

Wraps any KettleException from locating or deleting a database connection by name in deleteDatabaseMeta, using the localized message key KettleDatabaseRepository.Exception.ErrorDeletingConnection.Message with the connection name interpolated. Typical inner cause is the connection name not resolving to an id, or a failed delete statement.

Solutions

  1. Confirm the exact connection name exists in the repository (Repository Explorer) including case
  2. Check the connected user has permission to delete database connections (RepositoryOperation.DELETE_DATABASE)
  3. Inspect the wrapped KettleException for the underlying database failure
  4. If it's a dependency issue, see the related 'still in use by N jobs and M transformations' error and remove references first

Example fix

// before
repository.deleteDatabaseMeta("OldConn"); // may not exist
// after
if (repository.getDatabaseIDs(false).stream().anyMatch(id ->
    "OldConn".equals(repository.getDatabaseMeta(id).getName()))) {
  repository.deleteDatabaseMeta("OldConn");
}
Defensive patterns

Strategy: validation

Validate before calling

// verify the connection exists before deleting
ObjectId id = databaseDelegate.getDatabaseID(databaseName);
if (id == null) { return; } // nothing to delete, skip

Type guard

ObjectId id = databaseDelegate.getDatabaseID(name);
if (id == null) { throw new IllegalArgumentException("No such database connection: " + name); }

Try / catch

try {
  repository.deleteDatabaseMeta(name);
} catch (KettleException e) {
  if (e.getCause() instanceof KettleDependencyException) {
    // handle in-use case (see dependency error)
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling deleteDatabaseMeta(databaseName) where getDatabaseID(databaseName) fails (no such connection) or delDatabase(id_database) throws a database error.

Common situations: Deleting a connection that was already removed or renamed; case-sensitivity mismatch in the name; permission denied by the security provider for DELETE_DATABASE; DB error during the delete.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

  /**
   * Remove a database connection from the repository
   *
   * @param databaseName
   *          The name of the connection to remove
   * @throws KettleException
   *           In case something went wrong: database error, insufficient permissions, depending objects, etc.
   */
  public void deleteDatabaseMeta( String databaseName ) throws KettleException {

    repository.getSecurityProvider().validateAction( RepositoryOperation.DELETE_DATABASE );

    try {
      ObjectId id_database = getDatabaseID( databaseName );
      delDatabase( id_database );

    } catch ( KettleException dbe ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "KettleDatabaseRepository.Exception.ErrorDeletingConnection.Message", databaseName ), dbe );
    }
  }

  public synchronized void delDatabase( ObjectId id_database ) throws KettleException {
    repository.getSecurityProvider().validateAction( RepositoryOperation.DELETE_DATABASE );

    // First, see if the database connection is still used by other connections...
    // If so, generate an error!!
    // We look in table R_STEP_DATABASE to see if there are any steps using this database.
    //
    String[] transList = repository.getTransformationsUsingDatabase( id_database );
    String[] jobList = repository.getJobsUsingDatabase( id_database );

    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 );

View on GitHub (pinned to f3058517a1)