{"record":{"id":"68ac4d85506814ff","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-database-connection-from-the-file-repository","errorCode":null,"errorMessage":"Unable to load database connection from the file repository","messagePattern":"Unable to load database connection from the file repository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java","lineNumber":913,"sourceCode":"      //\n      String filename = calcDirectoryName( null ) + id.getId();\n      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );\n      Document document = XMLHandler.loadXMLFile( fileObject );\n      Node node = XMLHandler.getSubNode( document, tag );\n\n      return node;\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to load XML object from object with ID [\"\n        + id + \"] and tag [\" + tag + \"]\", e );\n    }\n  }\n\n  @Override\n  public DatabaseMeta loadDatabaseMeta( ObjectId id_database, String versionName ) throws KettleException {\n    try {\n      return new DatabaseMeta( loadNodeFromXML( id_database, DatabaseMeta.XML_TAG ) );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to load database connection from the file repository\", e );\n    }\n  }\n\n  @Override\n  public DatabaseMeta loadDatabaseMetaFromJobEntryAttribute( ObjectId id_jobentry, String nameCode, int nr,\n    String idCode, List<DatabaseMeta> databases ) throws KettleException {\n    return null;\n  }\n\n  @Override\n  public void saveDatabaseMetaJobEntryAttribute( ObjectId id_job, ObjectId id_jobentry, int nr, String nameCode,\n    String idCode, DatabaseMeta database ) throws KettleException {\n  }\n\n  @Override\n  public DatabaseMeta loadDatabaseMetaFromStepAttribute( ObjectId id_step, String code,\n    List<DatabaseMeta> databases ) throws KettleException {\n    return null;","sourceCodeStart":895,"sourceCodeEnd":931,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java#L895-L931","documentation":"loadDatabaseMeta(id, versionName) constructs a DatabaseMeta from the XML node loaded by loadNodeFromXML(id, DatabaseMeta.XML_TAG); any exception (node not loadable or constructor parse failure) is wrapped in this fixed-message KettleException. The actual reason is available via getCause().","triggerScenarios":"Calling loadDatabaseMeta with an id whose database-connection file is absent, unreadable, or whose XML is not a valid <connection> node parseable by DatabaseMeta.","commonSituations":"Referenced database connection deleted from the repository; hand-edited or partially saved connection XML; repository directory permissions blocking read; wrong repository opened so the id resolves to nothing.","solutions":["Verify the database connection object exists in the repository (search by name in Spoon)","Recreate the connection in Spoon and re-save if its XML is corrupt","Check getCause() to distinguish missing-file from parse errors","Ensure you are connected to the intended repository/base directory"],"exampleFix":"// before\nDatabaseMeta db = repository.loadDatabaseMeta(id, null);\n// after\nDatabaseMeta db;\ntry {\n  db = repository.loadDatabaseMeta(id, null);\n} catch (KettleException e) {\n  db = DatabaseMeta.findDatabase(sharedDatabases, expectedName);\n  if (db == null) throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (id_database == null) throw new KettleException(\"Transformation/job references no database connection id\");","typeGuard":null,"tryCatchPattern":"try {\n  DatabaseMeta db = repository.loadDatabaseMeta(id, null);\n} catch (KettleException e) {\n  DatabaseMeta fallback = DatabaseMeta.findDatabase(availableDatabases, expectedName);\n  if (fallback == null) throw new KettleException(\"Connection missing in repository\", e);\n  db = fallback;\n}","preventionTips":["Ensure referenced connections are saved in the same repository as the transformations","Recreate corrupted connections in Spoon rather than editing XML by hand","Confirm you are connected to the correct repository/environment before loading"],"tags":["file-repository","kettle","database-meta","xml"],"backgroundTag":"entity-not-found","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"}