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&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. Itsnameis 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
| Element | Required | Meaning |
|---|---|---|
name attribute | yes | Catalog name shown to clients |
<DataSourceInfo> | no | Connection string for this catalog. If omitted, the <DataSource>’s connection is used |
<Definition> | yes | Path 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 ;:
| Key | Meaning |
|---|---|
Provider=mondrian | Always mondrian |
Jdbc | JDBC URL of the database |
JdbcDrivers | JDBC driver class |
JdbcUser, JdbcPassword | Database 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 &:
jdbc:clickhouse://host:8123/db?user=me&password=secret
Applying changes
docker compose restart eMondrianThe same applies to changes in schema files.
Common mistakes
| Symptom | Cause |
|---|---|
| Catalog is missing | XML 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 & |
| 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.