pentaho/pentaho-kettle · error · MetaStoreException

Unable to assemble URL from database

Error message

Unable to assemble URL from database '${name}'

What it means

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.

Solutions

  1. Fix the DatabaseMeta connection settings (host, port, database name) so the plugin can build a URL
  2. For generic JDBC, set the manual URL and driver class explicitly
  3. Log the wrapped cause to see why URL assembly failed

Example fix

// before
DatabaseMeta db = new DatabaseMeta(); db.setDatabaseType( "GENERIC" ); // no URL
element = DatabaseMetaStoreUtil.databaseElement( metaStore, db ); // throws
// after
db.setManualUrl( "jdbc:mysql://localhost:3306/mydb" );
db.addAttribute( "CUSTOM_URL", "jdbc:mysql://localhost:3306/mydb" );
element = DatabaseMetaStoreUtil.databaseElement( metaStore, db );
Defensive patterns

Strategy: validation

Validate before calling

try {
  String url = databaseMeta.getURL();
  if ( url == null || url.isEmpty() ) throw new IllegalArgumentException( "URL could not be assembled" );
} catch ( Exception e ) {
  throw new IllegalArgumentException( "Fix connection settings before saving: " + e.getMessage(), e );
}

Prevention

When it happens

Trigger: 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.

Common situations: Generic/GenericDatabase plugin without manual URL set; missing database name; wrong port or special characters; custom database plugin whose URL generation fails.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/metastore/DatabaseMetaStoreUtil.java:178

      String attribute = (String) attributes.get( code );
      // Add it to the attributes child
      //
      attributesChild.addChild( metaStore.newAttribute( code, attribute ) );
    }

    // Extra information for 3rd-party tools:
    //
    // The driver class
    //
    element
      .addChild( metaStore.newAttribute( MetaStoreConst.DB_ATTR_DRIVER_CLASS, databaseMeta.getDriverClass() ) );

    // The URL
    //
    try {
      element.addChild( metaStore.newAttribute( MetaStoreConst.DB_ATTR_JDBC_URL, databaseMeta.getURL() ) );
    } catch ( Exception e ) {
      throw new MetaStoreException( "Unable to assemble URL from database '" + databaseMeta.getName() + "'", e );
    }

    return element;
  }

  public static DatabaseMeta loadDatabaseMetaFromDatabaseElement( IMetaStore metaStore, IMetaStoreElement element ) throws KettlePluginException {
    DatabaseMeta databaseMeta = new DatabaseMeta();
    PluginRegistry pluginRegistry = PluginRegistry.getInstance();

    // Load the appropriate database plugin (database interface)
    //
    String pluginId = getChildString( element, MetaStoreConst.DB_ATTR_ID_PLUGIN_ID );
    String driverClassName = getChildString( element, MetaStoreConst.DB_ATTR_DRIVER_CLASS );
    if ( Utils.isEmpty( pluginId ) && Utils.isEmpty( driverClassName ) ) {
      throw new KettlePluginException( "The attributes 'plugin_id' and 'driver_class' can't be both empty" );
    }
    if ( Utils.isEmpty( pluginId ) ) {
      // Determine pluginId using the plugin registry.

View on GitHub (pinned to f3058517a1)