datasources.xml in the project folder declares the catalogs eMondrian serves: for each catalog, a database connection and a schema file. It is mounted into the server as WEB-INF/datasources.xml.

Structure

<?xml version="1.0"?>
<DataSources>
  <DataSource>
    <DataSourceName>Foodmart</DataSourceName>
    <DataSourceDescription>Foodmart Sample Data</DataSourceDescription>
    <URL>http://localhost:8080/emondrian/xmla</URL>
    <DataSourceInfo>Provider=mondrian;Jdbc=jdbc:hsqldb:res:/hsqldb-foodmart/foodmart;JdbcDrivers=org.hsqldb.jdbc.JDBCDriver</DataSourceInfo>
    <ProviderName>Mondrian</ProviderName>
    <ProviderType>MDP</ProviderType>
    <AuthenticationMode>Unauthenticated</AuthenticationMode>
    <Catalogs>
      <Catalog name="FoodMart">
        <Definition>/WEB-INF/schema/Foodmart.xml</Definition>
      </Catalog>
      <Catalog name="OnTime">
        <DataSourceInfo>Provider=mondrian;Jdbc=jdbc:clickhouse://clickhouse:8123/default?user=default&amp;password=;JdbcDrivers=com.clickhouse.jdbc.ClickHouseDriver</DataSourceInfo>
        <Definition>/WEB-INF/schema/OnTime.xml</Definition>
      </Catalog>
    </Catalogs>
  </DataSource>
</DataSources>
  • The <DataSource> block describes the server. Its <DataSourceInfo> is the default connection for catalogs that don’t define their own (FoodMart above).
  • Each <Catalog> is one semantic model. Its name is what users see as the database in Excel and Power BI.
  • To add your own model, add a <Catalog> inside <Catalogs>. Usually you don’t need to touch the rest.

Catalog elements

ElementRequiredMeaning
name attributeyesCatalog name shown to clients
<DataSourceInfo>noConnection string for this catalog. If omitted, the <DataSource>’s connection is used
<Definition>yesPath to the schema file. The project’s schema/ folder is /WEB-INF/schema/

Order matters

Inside <Catalog>, write <DataSourceInfo> before <Definition>. The parser reads them in order; reversed, the connection string is silently dropped and the catalog uses the default connection.

Connection string

<DataSourceInfo> is a list of key=value pairs separated by ;:

KeyMeaning
Provider=mondrianAlways mondrian
JdbcJDBC URL of the database
JdbcDriversJDBC driver class
JdbcUser, JdbcPasswordDatabase credentials (alternatively, put them in the JDBC URL if the driver supports it)

Examples for ClickHouse and PostgreSQL: Connect databases.

Escaping

datasources.xml is XML: write & as &amp;:

jdbc:clickhouse://host:8123/db?user=me&amp;password=secret

Applying changes

docker compose restart eMondrian

The same applies to changes in schema files.

Common mistakes

SymptomCause
Catalog is missingXML error in the file, or no restart. Check mondrian.log
Catalog connects to the wrong database<Definition> written before <DataSourceInfo>
Connection error mentioning & or an unexpected parameter& not escaped as &amp;
Schema file not found<Definition> path doesn’t start with /WEB-INF/schema/, or the file isn’t in schema/

The original Mondrian documentation describes further options: Describe the data sources in datasources.xml.