2

I wish to connect to SSAS 2012 using Java and have tried olap4j driver for the same. I am working on Linux (Ubuntu 14.04) platform.

I have read that Olap4j works for Windows but will it work on Linux ?

I have written some Java code which gives runtime error. This error is because the Linux machine is unable to connect to SSAS.

I have set http access and IIS server and using msmdpump.dll to connect.

Below is the Java code and the error.:

CODE

package ssas;
import java.sql.Connection;
//import java.lang.*;
import java.sql.DriverManager;
import java.sql.SQLException;    

import org.olap4j.Cell;
import org.olap4j.CellSet;
import org.olap4j.OlapConnection;
import org.olap4j.OlapException;
import org.olap4j.OlapStatement;
import org.olap4j.OlapWrapper;
import org.olap4j.Position;
import org.olap4j.metadata.Member;

public class connexionSSAS
{
    public static void main(String[] args) throws ClassNotFoundException,
                                                  OlapException {

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

    Connection connection = null;
    try {
        connection = DriverManager.getConnection(
            "jdbc:xmla:Server=http://01XXXXXXXX/olap/msmdpump.dll;" +
            "Catalog=sample_Cube");
    } catch (SQLException e) {
        e.printStackTrace();
    }

    if (null == connection) {
        System.out.println("Cnul");
    }

    OlapWrapper wrapper = (OlapWrapper) connection;
    OlapConnection olapConnection = null;
    try {
        olapConnection = wrapper.unwrap(OlapConnection.class);
    } catch (SQLException e) {
        e.printStackTrace();
    }

    olapConnection.setCatalog("sample_Cube");
    OlapStatement statement = null;
    CellSet cellSet = null;        

    System.out.println(olapConnection.getCatalog());

    try {
        statement = (OlapStatement) olapConnection.createStatement();

        CellSet=statement.executeOlapQuery(
            "Summarize(FactDiagnosis,FactDiagnosis[ImportDateKey])");
        args}    
    catch(SQLException e) {
        e.printStackTrace();
    }
    }
}

ERROR

Exception in thread "main" java.lang.RuntimeException: org.olap4j.OlapException: This connection encountered an exception while executing a query.
at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:96)
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.getOlapCatalogs(XmlaOlap4jConnection.java:527)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.setCatalog(XmlaOlap4jConnection.java:483)
at ssas.connexionSSAS.main(connexionSSAS.java:49)
Caused by: org.olap4j.OlapException: This connection encountered an exception while executing a query.
at org.olap4j.driver.xmla.XmlaHelper.createException(XmlaHelper.java:43)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.executeMetadataRequest(XmlaOlap4jConnection.java:878)
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)
... 5 more

This code will run if I comment the statements containing 'OlapConnection'. Any help would be appreciated.

DaveR
  • 9,540
  • 3
  • 39
  • 58
Anjali
  • 31
  • 2
  • Your stack trace doesn't tell us what the root cause of the exception is. Please update your question with the full stack. – Luc Aug 29 '14 at 14:31
  • @Luc May you specifically tell what more do I need to add to make it clear ? – Anjali Sep 01 '14 at 05:02

0 Answers0