pentaho/pentaho-kettle · error · OlapException

Error setting catalog for MDX statement: ''

Error message

Error setting catalog for MDX statement: ''

What it means

OlapHelper.openQuery() sets the catalog (database) on the Mondrian/OLAP connection before executing an MDX query. If olapConnection.setCatalog(catalogName) throws a SQLException, it is rethrown as an OlapException with 'Error setting catalog for MDX statement: <catalogName>'. Note the original SQLException is not chained.

Solutions

  1. Verify the catalog name exactly matches a catalog deployed on the OLAP server (check case and spelling).
  2. Confirm the OLAP connection is still valid — reconnect before openQuery; check the JDBC/XMLA endpoint is reachable.
  3. Deploy the catalog (e.g. Mondrian schema) to the server or point the step at an existing catalog.
  4. Check driver compatibility between Pentaho and the OLAP server version.

Example fix

// before
String catalogName = "SalesCube_old";
// after
String catalogName = "SalesCube"; // name deployed on the OLAP server
Defensive patterns

Strategy: validation

Validate before calling

// Verify the catalog exists on the server before openQuery
// e.g. query available catalogs via olapConnection.getCatalogs() and check catalogName

Type guard

boolean catalogExists(OlapConnection c, String name) { try { return c.getCatalogs().asIterator().stream().anyMatch(cat -> name.equals(cat.getName())); } catch (SQLException e) { return false; } }

Try / catch

try { helper.openQuery(); } catch (OlapException e) { log.error("Catalog setup failed for MDX: " + e.getMessage(), e); /* validate catalog name / reconnect */ }

Prevention

When it happens

Trigger: openQuery() when the OLAP connection's setCatalog(catalogName) raises SQLException — nonexistent/misspelled catalog name, connection already closed/broken, driver rejection.

Common situations: Catalog name typo or catalog not deployed on the OLAP server; connection timed out or was closed before use; wrong JDBC/OLAP driver version; XMLA server not exposing the requested catalog; case-sensitivity mismatch.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/olapinput/OlapHelper.java:81

    Class.forName( olap4jDriver );
    OlapConnection connection = null;

    if ( Utils.isEmpty( username ) && Utils.isEmpty( password ) ) {
      connection = (OlapConnection) DriverManager.getConnection( olap4jUrl );
    } else {
      connection = (OlapConnection) DriverManager.getConnection( olap4jUrl, username, password );
    }

    OlapWrapper wrapper = connection;
    olapConnection = wrapper.unwrap( OlapConnection.class );

    try {
      if ( !Utils.isEmpty( catalogName ) ) {
        olapConnection.setCatalog( catalogName );
      }
    } catch ( SQLException e ) {
      throw new OlapException( "Error setting catalog for MDX statement: '" + catalogName + "'" );
    }

    OlapStatement stmt = olapConnection.createStatement();

    if ( !Utils.isEmpty( mdx ) ) {
      CellSet tmp = stmt.executeOlapQuery( mdx );
      result = tmp;
    } else {
      throw new Exception( "Error executing empty MDX query" );
    }

  }

  public void close() throws KettleDatabaseException {
    try {
      if ( result != null ) {
        result.close();
      }

View on GitHub (pinned to f3058517a1)