我有一个数据源,它有一个提供程序 MSOLAP 我想通过基于 java 的应用程序连接到这个源。我使用了以下内容:
public static void main(String[] args) throws Exception {
// Load the driver
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
// Connect
final Connection connection =
DriverManager.getConnection(
// This is the SQL Server service end point.
"jdbc:xmla:Server=http://localhost:81/mondrian/xmla"
// Tells the XMLA driver to use a SOAP request cache layer.
// We will use an in-memory static cache.
+ ";Cache=org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache"
// Sets the cache name to use. This allows cross-connection
// cache sharing. Don't give the driver a cache name and it
// disables sharing.
+ ";Cache.Name=MyNiftyConnection"
// Some cache performance tweaks.
// Look at the javadoc for details.
+ ";Cache.Mode=LFU;Cache.Timeout=600;Cache.Size=100",
// XMLA is over HTTP, so BASIC authentication is used.
null,
null);
// We are dealing with an olap connection. we must unwrap it.
final OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
// Check if it's all groovy
ResultSet databases = olapConnection.getMetaData().getDatabases();
databases.first();
System.out.println(
olapConnection.getMetaData().getDriverName()
+ " -> "
+ databases.getString(1));
// Done
connection.close();
}
我得到的类OlapConnection
没有编译。我有两个问题: 1-我正在使用 maven 构建这个测试,它没有显示错误,为什么找不到这个类?
2-有没有其他方法可以在不使用 olap4j 的情况下连接到 MSOLAP?