Eclipse et sql server2005

Fermé
Nehed - 18 mars 2010 à 22:24
je veu faire la connexion entre eclispe et sql server2005 a travers le pilote olap4j
voilà le code

import java.io.FileNotFoundException;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.olap4j.CellSet;
import org.olap4j.OlapConnection;
import org.olap4j.OlapStatement;
import org.olap4j.OlapWrapper;
import org.olap4j.OlapException;

public class fd {



public static void main(String[] args) throws SQLException,FileNotFoundException{

try{
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
System.out.println("le pilot est chargé");
OlapConnection connexion =(OlapConnection)DriverManager.getConnection("jdbc:xmla:Server=http://localhost/olap/msmdpump.dll;Catalog=FoodMart 2005");

OlapWrapper wrapper = (OlapWrapper) connexion;
OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
OlapStatement stmt = olapConnection.createStatement();
System.out.println("la connexion à la base est bien determinée");
CellSet cellSet =stmt .executeOlapQuery(
"SELECT {[Measures].[Unit Sales]} ON COLUMNS,\n"
+ " {[Product].Members} ON ROWS\n}"

+ "FROM [Sales]");

}
catch(Exception ex){
System.out.println("dddd");
System.err.println("Erreur pendant la connexion");

System.out.println("mmmmmmmm");
ex.printStackTrace();
System.out.println("dddd");
}

}

}




et voilà le pb:

le pilot est chargé
la connexion à la base est bien determinée
dddd
mmmmmmmm
Erreur pendant la connexion
java.lang.RuntimeException: [FATAL]:1:1: Content is not allowed in prolog.

at org.olap4j.driver.xmla.XmlaOlap4jUtil.checkForParseError(XmlaOlap4jUtil.java:126)
at org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:75)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.xxx(XmlaOlap4jConnection.java:616)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getMetadata(XmlaOlap4jDatabaseMetaData.java:127)
at org.olap4j.driver.xmla.XmlaOlap4jDatabaseMetaData.getDatasources(XmlaOlap4jDatabaseMetaData.java:932)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.getDataSourceInfo(XmlaOlap4jConnection.java:252)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.generateRequest(XmlaOlap4jConnection.java:749)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.populateList(XmlaOlap4jConnection.java:585)
at org.olap4j.driver.xmla.DeferredNamedListImpl.populateList(DeferredNamedListImpl.java:102)
at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:71)
at org.olap4j.driver.xmla.DeferredNamedListImpl.get(DeferredNamedListImpl.java:94)
at org.olap4j.driver.xmla.DeferredNamedListImpl.get(DeferredNamedListImpl.java:43)
at org.olap4j.driver.xmla.XmlaOlap4jConnection.getCatalog(XmlaOlap4jConnection.java:377)
at org.olap4j.driver.xmla.XmlaOlap4jStatement.executeOlapQuery(XmlaOlap4jStatement.java:257)
at fd.main(fd.java:26)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.olap4j.driver.xmla.XmlaOlap4jUtil.parse(XmlaOlap4jUtil.java:72)
... 13 more
dddd


merci d avance!