{"record":{"id":"4e9e55808a9fe04f","repo":"pentaho/pentaho-kettle","slug":"unable-to-assemble-url-from-database-name","errorCode":null,"errorMessage":"Unable to assemble URL from database '${name}'","messagePattern":"Unable to assemble URL from database '(.+?)'","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/metastore/DatabaseMetaStoreUtil.java","lineNumber":178,"sourceCode":"      String attribute = (String) attributes.get( code );\n      // Add it to the attributes child\n      //\n      attributesChild.addChild( metaStore.newAttribute( code, attribute ) );\n    }\n\n    // Extra information for 3rd-party tools:\n    //\n    // The driver class\n    //\n    element\n      .addChild( metaStore.newAttribute( MetaStoreConst.DB_ATTR_DRIVER_CLASS, databaseMeta.getDriverClass() ) );\n\n    // The URL\n    //\n    try {\n      element.addChild( metaStore.newAttribute( MetaStoreConst.DB_ATTR_JDBC_URL, databaseMeta.getURL() ) );\n    } catch ( Exception e ) {\n      throw new MetaStoreException( \"Unable to assemble URL from database '\" + databaseMeta.getName() + \"'\", e );\n    }\n\n    return element;\n  }\n\n  public static DatabaseMeta loadDatabaseMetaFromDatabaseElement( IMetaStore metaStore, IMetaStoreElement element ) throws KettlePluginException {\n    DatabaseMeta databaseMeta = new DatabaseMeta();\n    PluginRegistry pluginRegistry = PluginRegistry.getInstance();\n\n    // Load the appropriate database plugin (database interface)\n    //\n    String pluginId = getChildString( element, MetaStoreConst.DB_ATTR_ID_PLUGIN_ID );\n    String driverClassName = getChildString( element, MetaStoreConst.DB_ATTR_DRIVER_CLASS );\n    if ( Utils.isEmpty( pluginId ) && Utils.isEmpty( driverClassName ) ) {\n      throw new KettlePluginException( \"The attributes 'plugin_id' and 'driver_class' can't be both empty\" );\n    }\n    if ( Utils.isEmpty( pluginId ) ) {\n      // Determine pluginId using the plugin registry.","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/metastore/DatabaseMetaStoreUtil.java#L160-L196","documentation":"While populating the metastore element, the JDBC URL attribute (DB_ATTR_JDBC_URL) is set from databaseMeta.getURL(). If getURL() throws (typically because the database plugin could not assemble a URL from the connection settings) it is wrapped in a MetaStoreException. This indicates malformed or incomplete connection parameters on the DatabaseMeta.","triggerScenarios":"Saving a database connection whose type/hostname/port/database fields are insufficient for the plugin's URL format, so getURL() throws inside the try block.","commonSituations":"Generic/GenericDatabase plugin without manual URL set; missing database name; wrong port or special characters; custom database plugin whose URL generation fails.","solutions":["Fix the DatabaseMeta connection settings (host, port, database name) so the plugin can build a URL","For generic JDBC, set the manual URL and driver class explicitly","Log the wrapped cause to see why URL assembly failed"],"exampleFix":"// before\nDatabaseMeta db = new DatabaseMeta(); db.setDatabaseType( \"GENERIC\" ); // no URL\nelement = DatabaseMetaStoreUtil.databaseElement( metaStore, db ); // throws\n// after\ndb.setManualUrl( \"jdbc:mysql://localhost:3306/mydb\" );\ndb.addAttribute( \"CUSTOM_URL\", \"jdbc:mysql://localhost:3306/mydb\" );\nelement = DatabaseMetaStoreUtil.databaseElement( metaStore, db );","handlingStrategy":"validation","validationCode":"try {\n  String url = databaseMeta.getURL();\n  if ( url == null || url.isEmpty() ) throw new IllegalArgumentException( \"URL could not be assembled\" );\n} catch ( Exception e ) {\n  throw new IllegalArgumentException( \"Fix connection settings before saving: \" + e.getMessage(), e );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call getURL() as a dry-run before persisting a connection","For GENERIC connections always set a manual URL","Validate host/port/database fields before save"],"tags":["metastore","jdbc","url"],"backgroundTag":"invalid-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"}