1
나는 공급자가있는 데이터 소스를 가지고 있습니다. MSOLAP Java 기반 응용 프로그램을 통해이 소스에 연결하고 싶습니다. 나는 다음을 사용했다 :MS OLAP with 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에 연결할 수있는 다른 방법이 있습니까?
난 당신이 표시된 예제를 시도했지만 여전히 받는다는 종속성 OlapConnection 클래스를 제공 할 수 있습니다. 코드를 업데이트했습니다. –
문제가 Maven과 관련되어 있으면 olap4j와 관련이없는 별도의 문제입니다. org.olap4j : olap4j와 org.olap4j : olap4j-xmla를 종속 관계로 포함하고 있는지 확인하는 것이 좋습니다. – Luc