无法在Linux上使用olap4j连接到SSAS

时间:2014-08-28 06:38:15

标签: java linux ssas runtimeexception olap4j

我希望使用Java连接到SSAS 2012并尝试使用olap4j驱动程序。 我正在使用Linux(Ubuntu 14.04)平台。

我已经读过Olap4j适用于Windows但是它可以在Linux上运行吗?

我编写了一些Java代码,它给出了运行时错误。此错误是因为Linux计算机无法连接到SSAS。

我已设置http访问权限和IIS服务器并使用msmdpump.dll进行连接。

以下是Java代码和错误。:

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

如果我评论包含'OlapConnection'的语句,则会运行此代码。 任何帮助将不胜感激。

0 个答案:

没有答案