I do not know how I can generate or create Cube with Olap4j/Olap connection, when I have Cube I can load it and work with it, but I have database and I want from code generate Cube and save it as xml. So how many ways we have for it?
Connection connection = DriverManager.getConnection(
String.format(
"jdbc:mondrian:Jdbc=%s; Catalog=file:%s",
"jdbc:mysql://localhost:3306/network?user=root&password=root",
"C:\\Users\\John\\Documents\\pivot4j-web\\src\\java\\org\\pivot4j\\analytics\\test\\FoodMartX.xml"
)
);
OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
Schema s = olapConnection.getOlapSchema();
System.out.println("Schema: " + s.getName());
for (Cube cube : s.getCubes()) {
System.out.println("Cube: " + cube.getName());
for (Dimension dimension : cube.getDimensions()) {
System.out.println("Dimension: " + dimension.getName());
}
for (Measure measure : cube.getMeasures()) {
System.out.println("Measure: " + measure.getName());
}
}