{"record":{"id":"4333956024a88738","repo":"pentaho/pentaho-kettle","slug":"deletemeta-exception-connectionundefined","errorCode":"DeleteMeta.Exception.ConnectionUndefined","errorMessage":"DeleteMeta.Exception.ConnectionUndefined","messagePattern":"DeleteMeta\\.Exception\\.ConnectionUndefined","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/delete/DeleteMeta.java","lineNumber":610,"sourceCode":"   *          the schemaName to set\n   */\n  public void setSchemaName( String schemaName ) {\n    this.schemaName = schemaName;\n  }\n\n  public boolean supportsErrorHandling() {\n    return true;\n  }\n\n  public void setConnection( String connectionName ) throws KettleException {\n    // Get the databases from the Database connection list this is required by\n    // MDI injection of the connection name\n    databaseMeta = DatabaseMeta.findDatabase( getParentStepMeta().getParentTransMeta().getDatabases(), connectionName );\n    if ( databaseMeta == null ) {\n      String errMsg = BaseMessages.getString( PKG, \"DeleteMeta.Exception.ConnectionUndefined\",\n              getParentStepMeta().getName(), connectionName );\n      logError( errMsg );\n      throw new KettleException( errMsg );\n    }\n  }\n\n  public static class KeyFields implements Cloneable {\n    /** field in table */\n    @Injection( name = \"TABLE_NAME_FIELD\", group = \"FIELDS\", required = true )\n    private String keyLookup;\n\n    /** Comparator: =, <>, BETWEEN, ... */\n    @Injection( name = \"COMPARATOR\", group = \"FIELDS\", required = true )\n    private String keyCondition;\n\n    @Injection( name = \"STREAM_FIELDNAME_1\", group = \"FIELDS\", required = false )\n    private String keyStream;\n\n    /** Extra field for between... */\n    @Injection( name = \"STREAM_FIELDNAME_2\", group = \"FIELDS\", required = false )\n    private String keyStream2;","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/delete/DeleteMeta.java#L592-L628","documentation":"This is MDI (metadata injection) support code in DeleteMeta: given an injected connection name, it looks up the named database in the transformation's database list via DatabaseMeta.findDatabase. If no match is found, it logs and throws a KettleException naming the step and the missing connection name.","triggerScenarios":"During metadata injection, the constructor resolves connectionName against getParentStepMeta().getParentTransMeta().getDatabases(); if the transformation does not define a database connection with that exact name, databaseMeta is null and the exception is thrown.","commonSituations":"Metadata injection mapping references a connection name that doesn't exist in the target transformation; case/whitespace mismatch in the connection name; transformation moved between environments where shared connections weren't imported.","solutions":["Add a database connection with the exact injected name to the transformation before running the injection mapping.","Check the injected connection name for typos, case or trailing-whitespace mismatches.","Import the shared connection definitions when moving transformations between environments.","In your injection mapping code, verify the connection name against availableDatabaseNames before injecting."],"exampleFix":"// before\nmapper.addMapping(\"CONNECION_NAME\"); // typo\n// after\nmapper.addMapping(\"CONNECTION_NAME\"); // matches a defined DB connection in the transformation","handlingStrategy":"validation","validationCode":"List<String> available = transMeta.getDatabaseNames();\nif (!available.contains(connectionName)) {\n  throw new IllegalArgumentException(\"Connection not defined in transformation: \" + connectionName);\n}","typeGuard":null,"tryCatchPattern":"try { new DeleteMeta(stepMeta, injectMeta, injection); } catch (KettleException e) {\n  log.error(\"Injected connection missing: {}\", e.getMessage(), e);\n}","preventionTips":["Define all referenced DB connections in the transformation before injecting metadata.","Match connection names exactly (case, whitespace).","Import shared connections when moving between environments.","Validate injection mappings against available connection names at design time."],"tags":["metadata-injection","database-connection","configuration"],"backgroundTag":"missing-config-value","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"}