First, start an EuclidOLAP service, either by running binary or starting a Docker container.
Introduce the EuclidOLAP SDK into the project.
<dependency>
<groupId>com.euclidolap</groupId>
<artifactId>olap-sdk</artifactId>
<version>0.1.2</version>
</dependency>
Run the following code.
package com.euclidolap.demo4sdk;
import com.euclidolap.sdk.MultiDimResult;
import com.euclidolap.sdk.Terminal;
public class JavaSdkTestingCase {
static String host = "8.142.179.207";
static int port = 8760;
static String mdx =
"select " +
"{ ([starting date].[2021].Q1), ([starting date].[2021].Q2) } on 999, " +
"{ (measure.income), (measure.cost) } on 100 " +
"from [logistics.test] " +
"where " +
"( [Goods].[electronic product].[computer] , Transport.railway, [starting region].[Europe].[UK], " +
"[ending region].[Europe].[Italy], [completion date].[2020].[Q1].[M3] );";
public static void main(String[] args) {
Terminal euclidOlapTerminal = new Terminal(host, port);
euclidOlapTerminal.connect();
MultiDimResult result = (MultiDimResult) euclidOlapTerminal.exec(mdx);
result.show(System.out);
euclidOlapTerminal.close();
}
}