{"record":{"id":"065802dc56888a7f","repo":"pentaho/pentaho-kettle","slug":"unable-to-delete-database-with-name-name","errorCode":null,"errorMessage":"Unable to delete database with name [name]","messagePattern":"Unable to delete database with name \\[name\\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":1522,"sourceCode":"  }\n\n  @Override\n  public void deleteDatabaseMeta( final String databaseName ) throws KettleException {\n    RepositoryFile fileToDelete = null;\n    ObjectId idDatabase = null;\n\n    try {\n      readWriteLock.writeLock().lock();\n      try {\n        fileToDelete = pur.getFile( getPath( databaseName, null, RepositoryObjectType.DATABASE ) );\n        idDatabase = new StringObjectId( fileToDelete.getId().toString() );\n        permanentlyDeleteSharedObject( idDatabase );\n        removeFromSharedObjectCache( RepositoryObjectType.DATABASE, idDatabase );\n      } finally {\n        readWriteLock.writeLock().unlock();\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete database with name [\" + databaseName + \"]\", e );\n    }\n  }\n\n  @Override\n  public long getJobEntryAttributeInteger( ObjectId idJobentry, int nr, String code ) throws KettleException {\n    // implemented by RepositoryProxy\n    throw new UnsupportedOperationException();\n  }\n\n  @Override\n  public String getJobEntryAttributeString( ObjectId idJobentry, int nr, String code ) throws KettleException {\n    // implemented by RepositoryProxy\n    throw new UnsupportedOperationException();\n  }\n\n  @Override\n  public boolean getJobEntryAttributeBoolean( ObjectId arg0, int arg1, String arg2, boolean arg3 )\n    throws KettleException {","sourceCodeStart":1504,"sourceCodeEnd":1540,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L1504-L1540","documentation":"Repository failure in PurRepository.deleteDatabaseMeta: the database connection file could not be located or deleted (lookup via getPath returned null or the delete call failed). The message includes the database name and wraps the underlying exception.","triggerScenarios":"Calling deleteDatabaseMeta(String) when the repository cannot delete the file — permission denied, file locked/checked out, or the connection doesn't resolve to an existing repository file.","commonSituations":"Users lacking delete rights on /etc/databases; the database was already deleted in another session; ETC folder write lock held by versioning.","solutions":["Verify the repository user has delete permission on the shared databases area.","Confirm the DatabaseMeta still exists (getDatabaseIDs/getDatabaseNames) before deleting.","Retry after resolving file locks or versioning checkout state.","Catch KettleException and surface the cause to the user instead of failing silently."],"exampleFix":"// before\nrepository.deleteDatabaseMeta(meta.getName());\n// after\ntry {\n  repository.deleteDatabaseMeta(meta.getName());\n} catch (KettleException e) {\n  logError(\"Could not delete connection: \" + e.getCause(), e);\n}","handlingStrategy":"try-catch","validationCode":"// check existence before delete\nboolean exists = repository.getDatabaseNames(false) contains meta.getName();","typeGuard":"boolean deletable = name -> name != null && repositoryExists(name);","tryCatchPattern":"try { repository.deleteDatabaseMeta(name); } catch (KettleException e) { log.error(\"delete failed: \" + e.getCause(), e); }","preventionTips":["Ensure delete permission on /etc/databases for the user.","Check the DB still exists before attempting deletion.","Avoid concurrent sessions deleting the same connection.","Surface the cause exception to end users."],"tags":["repository","kettle","delete","permissions"],"backgroundTag":"database-write-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"}