eMondrian reads data from any database with a JDBC driver. The image includes drivers for:
| Database | Driver class | Included |
|---|---|---|
| ClickHouse | com.clickhouse.jdbc.ClickHouseDriver | ✓ (0.8.2) |
| PostgreSQL | org.postgresql.Driver | ✓ (42.2.20) |
| HSQLDB | org.hsqldb.jdbc.JDBCDriver | ✓ (used by FoodMart) |
| MySQL, SQL Server, Oracle, others | see the vendor’s documentation | add the driver — see below |
A connection is declared as a catalog in datasources.xml. The general shape:
<Catalog name="MyData">
<DataSourceInfo>Provider=mondrian;Jdbc=<JDBC URL>;JdbcUser=<user>;JdbcPassword=<password>;JdbcDrivers=<driver class></DataSourceInfo>
<Definition>/WEB-INF/schema/MyData.xml</Definition>
</Catalog>Details and rules (element order, escaping): datasources.xml reference. After changing datasources.xml, restart: docker compose restart eMondrian.
ClickHouse
<Catalog name="MyClickHouse">
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:clickhouse://my-host:8123/mydb?user=myuser&password=mypassword;JdbcDrivers=com.clickhouse.jdbc.ClickHouseDriver</DataSourceInfo>
<Definition>/WEB-INF/schema/MyClickHouse.xml</Definition>
</Catalog>- Port
8123is ClickHouse’s HTTP interface. For HTTPS (e.g. ClickHouse Cloud) use port8443and add&ssl=true. - The sample OnTime catalog adds settings for large queries, which you can reuse:
max_query_size=100000000&max_ast_elements=100000000&max_expanded_ast_elements=100000000&socket_timeout=300000 - In schemas, write ClickHouse SQL with
dialect="clickhouse". See Modeling on ClickHouse.
PostgreSQL
<Catalog name="MyPostgres">
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:postgresql://my-host:5432/mydb;JdbcUser=myuser;JdbcPassword=mypassword;JdbcDrivers=org.postgresql.Driver</DataSourceInfo>
<Definition>/WEB-INF/schema/MyPostgres.xml</Definition>
</Catalog>In schemas, use dialect="postgres" (not postgresql) for PostgreSQL-specific SQL.
Other databases: add a JDBC driver
- Download the driver JAR into a
drivers/folder in the project, e.g.drivers/mysql-connector-j-9.1.0.jar. - Mount it into the server’s library folder — in
docker-compose.yml, under theeMondrianservicevolumes:(there is a commented-out example for ClickHouse):- ./drivers/mysql-connector-j-9.1.0.jar:/usr/local/tomcat/webapps/emondrian/WEB-INF/lib/mysql-connector-j-9.1.0.jar - Use the driver class in the catalog, e.g.
JdbcDrivers=com.mysql.cj.jdbc.Driver. - Recreate the container:
docker compose up -d.
Not in
modules/The
modules/folder is for eMondrian modules and license files. JDBC drivers placed there are not found.
Database on the same machine
Inside the container, localhost is the container itself. To reach a database on the Docker host, use host.docker.internal:
jdbc:postgresql://host.docker.internal:5432/mydb
On Linux, also add to the eMondrian service in docker-compose.yml:
extra_hosts:
- "host.docker.internal:host-gateway"Database user
eMondrian only reads data. Give it a database user with read-only access to the tables and views your schemas use.
Troubleshooting
- Catalog doesn’t appear — check element order and
&in datasources.xml, then restart. - Connection errors —
mondrian.logshows the JDBC error. See Logs and Troubleshooting.