方法org.postgresql.jdbc4.Jdbc4Connection.unwrap尚未实现

方法org.postgresql.jdbc4.Jdbc4Connection.unwrap尚未实现,postgresql,jdbc,mondrian,Postgresql,Jdbc,Mondrian,堆栈跟踪: Exception in thread "main" org.pivot4j.PivotException: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.unwrap(Class<T>) is not yet implemented. at org.pivot4j.impl.PivotModelImpl.initialize(PivotM

堆栈跟踪:

Exception in thread "main" org.pivot4j.PivotException: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.unwrap(Class<T>) is not yet implemented.
    at org.pivot4j.impl.PivotModelImpl.initialize(PivotModelImpl.java:202)
    at cn.sdut.pivot4j.App.main(App.java:25)
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.unwrap(Class<T>) is not yet implemented.
    at org.postgresql.Driver.notImplemented(Driver.java:710)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.unwrap(AbstractJdbc4Connection.java:218)
    at org.postgresql.jdbc4.Jdbc4Connection.unwrap(Jdbc4Connection.java:21)
    at org.pivot4j.datasource.SimpleOlapDataSource.createConnection(SimpleOlapDataSource.java:77)
    at org.pivot4j.datasource.AbstractOlapDataSource.getConnection(AbstractOlapDataSource.java:105)
    at org.pivot4j.datasource.AbstractOlapDataSource.getConnection(AbstractOlapDataSource.java:95)
    at org.pivot4j.impl.PivotModelImpl.createConnection(PivotModelImpl.java:242)
    at org.pivot4j.impl.PivotModelImpl.initialize(PivotModelImpl.java:200)
    ... 1 more

我不知道为什么会出现这个异常。

我是Pivot4J的开发者,我想你的问题与这篇文章描述的一样:

您需要为数据源指定Olap4J的连接字符串,而不是底层RDBMS的连接字符串

有关连接字符串语法的参考,您可以参考API文档以获得适当的Olap4J驱动程序实现,即或

此外,如果您对Pivot4J有进一步的疑问,请随时访问我们的邮件列表

希望这有帮助

泽维尔

public class App {
    public static void main(String[] args) throws Exception {

        SimpleOlapDataSource dataSource = new SimpleOlapDataSource();
        dataSource.setConnectionString("jdbc:postgresql://localhost:5432/food_mart?user=postgres&password=111111");

        String initialMdx = "SELECT {[Measures].[Unit Sales], [Measures].[Store Cost], "
                + "[Measures].[Store Sales]} ON COLUMNS, {([Promotion Media].[All Media], "
                + "[Product].[All Products])} ON ROWS FROM [Sales]";

        PivotModel model = new PivotModelImpl(dataSource);
        model.setMdx(initialMdx);
        model.initialize(); // throws Exception
    }
}