I am beginner with the BI
concepts and mondrian
.I am using olap4j API
with mondrian
server and my requirement is to get the mysql column names mapped in the schema file or metadata about the database . Basically i am able to connect and can execute a sample query with the foodmart
sample data. Please provide me the sample code to get the columns names (i am using mysql) or db metadata
Sample code i am trying is
Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
Connection connection = DriverManager
.getConnection("jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart;Provider=Mondrian;"
+ "Catalog=D:/Softwares/mondrian-3.2.0.13661/demo/FoodMart.xml;PoolNeeded=false;JdbcUser=root;JdbcPassword=admin123;JdbcDrivers=com.mysql.jdbc.Driver;");
OlapWrapper wrapper = (OlapWrapper) connection;
OlapConnection olapConnection = wrapper
.unwrap(OlapConnection.class);
NamedList<Cube> cubes = olapConnection.getOlapSchema().getCubes();
for (Cube eachCube : cubes) {
System.out.println(" Cube name..." + eachCube.getName());
for (Measure measure : eachCube.getMeasures()) {
System.out.println(" Measures " + measure.getName());
System.out.println("Measure Levels...."
+ measure.getLevel().getCaption());
}
for (Hierarchy hierarchy : eachCube.getHierarchies()) {
System.out.println("hierarchy " + hierarchy.getName());
NamedList<Level> levels = hierarchy.getLevels();
for (Level l : levels) {
System.out.println(" Hierarchy levels " + l.getName());
List<Member> members = l.getMembers();
for(Member member:members){
System.out.println(" Member name " +member.getName());
}
}
}
}