Not able to access MSSQL analysis services cubes

405 views Asked by At

I am using the following code to access mssql analysis services cubes from java using OLAP4j 1.1.0

Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
OlapConnection con = (OlapConnection) 

DriverManager.getConnection("jdbc:xmla:Server=http://mssql.com/mssql/msmdpump.dll;"+
"Cache=org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache;"+
"Cache.Name=MyNiftyConnection;Cache.Mode=LFU;Cache.Timeout=600;Cache.Size=100", 
"username", "password");

OlapWrapper wrapper = (OlapWrapper) con;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement stmt = olapConnection.createStatement();

CellSet cellSet = stmt.executeOlapQuery("SELECT {" +
" [Measures].[LoginTime_Format]," +
"[Measures].[EngageTime_Format]," +
"[Measures].[ChatTime_Format]," +
"[Measures].[AverageHandleTime_Format]," +
"[Measures].[MultipleChatTime_Format]," +
"[Measures].[NonEngagedTime_Format]," +
"[Measures].[TimeAvailable_Format]," +
"[Measures].[TimeAvailableNotChatting_Format]," +
"[Measures].[TimeNotAvailable_Format]," +
"[Measures].[TimeNotAvailableChatting_Format]," +
"[Measures].[AcdTimeouts]," +
"[Measures].[AvgConcurrency]," +
"[Measures].[OperatorUtilization]} ON 0," +
" NON EMPTY ([DimTime].[CalenderDayHour].[CalenderDayHour], [DimAgent].[Agent]."+
"[Agent],[DimAgent].[Agent Name].[Agent Name]) ON 1" +
" FROM (SELECT [DimClient].[Client].&[4] ON 0 FROM" +
" (SELECT [DimTime].[CalenderDayHour].[CalenderDayHour].&[2013010100]:"+
"[DimTime].[CalenderDayHour].[CalenderDayHour].&[2013121216] ON 0 FROM [247OLAP]))");

When I run this code I get the following exception at executeOlapQuery line-

Exception in thread "main" java.lang.RuntimeException: [FATAL]:1:1: Content is not allowed in prolog.

at org.olap4j.driver.xmla.XmlaOlap4jUtil.checkForParseError(XmlaOlap4jUtil.java:134)

at org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:83) at org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:884) at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:137) at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:67) at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getDatabaseProperties(XmlaOlap4jDatabaseMetaData.java:1044) at org.olap4j.driver.xmla.XmlaOlap4jConnection.makeConnectionPropertyList(XmlaOlap4jConnection.java:324) at org.olap4j.driver.xmla.XmlaOlap4jConnection.generateRequest(XmlaOlap4jConnection.java:1037) at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:849) at org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:136) at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:90) at org.olap4j.driver.xmla.DeferredNamedListImpl.size(DeferredNamedListImpl.java:116) at org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapDatabase(XmlaOlap4jConnection.java:451) at org.olap4j.driver.xmla.XmlaOlap4jConnection.getOlapCatalog(XmlaOlap4jConnection.java:501) at org.olap4j.driver.xmla.XmlaOlap4jConnection.getCatalog(XmlaOlap4jConnection.java:496) at org.olap4j.driver.xmla.XmlaOlap4jStatement.executeOlapQuery(XmlaOlap4jStatement.java:291) at com.tfsc.ilabs.olap4j.POC.main(POC.java:28) Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:80)

Any help will be much appreciated.

1

There are 1 answers

0
Luc On

You should check what's being sent back by the server, using WireShark or something similar. This kind of error happens when the XML parser tries to parse the response it got. The server is probably not sending XML content back.