本文整理汇总了Java中mondrian.olap.DriverManager类的典型用法代码示例。如果您正苦于以下问题:Java DriverManager类的具体用法?Java DriverManager怎么用?Java DriverManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DriverManager类属于mondrian.olap包,在下文中一共展示了DriverManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
private static Connection getConnection(String propertiesFileName) throws FileNotFoundException, IOException
{
if (propertiesFileName == null) {
throw new RuntimeException("connection properties file not set");
}
ConnectionData data = getConnectionData(propertiesFileName);
Connection connection = null;
if (data.isEnabled())
{
connection =
DriverManager.getConnection(
"Provider=mondrian;" +
"JdbcDrivers=" + data.getJdbcDrivers() + ";" +
"Jdbc=" + data.getJdbcUrl() + ";" +
"JdbcUser=" + data.getJdbcUser() + ";" +
"JdbcPassword=" + data.getJdbcPassword() + ";" +
"Catalog=" + data.getCatalogUri() + ";",
null
);
}
return connection;
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:MondrianApp.java
示例2: contributeParameters
import mondrian.olap.DriverManager; //导入依赖的package包/类
@Override
public void contributeParameters(Map<String, Object> parameters)
throws JRException {
MondrianDataAdapter mda = getJdbcDataAdapter();
if (mda != null) {
Util.PropertyList props = new Util.PropertyList();
props.put("Catalog", mda.getCatalogURI());
props.put("Provider", "mondrian");
props.put("Locale", Locale.getDefault().getLanguage());
connection = DriverManager.getConnection(props, null,
new SimpleSQLDataSource(this));
parameters
.put(JRMondrianQueryExecuterFactory.PARAMETER_MONDRIAN_CONNECTION,
connection);
}
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:MondrianDataAdapterService.java
示例3: getOlap4jConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
public OlapConnection getOlap4jConnection() throws SQLException {
try {
Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
} catch (ClassNotFoundException e) {
throw new RuntimeException("Driver not found");
}
String connectString = getConnectString();
if (connectString.startsWith("Provider=mondrian; ")) {
connectString =
connectString.substring("Provider=mondrian; ".length());
}
final java.sql.Connection connection =
java.sql.DriverManager.getConnection(
"jdbc:mondrian:" + connectString);
return ((OlapWrapper) connection).unwrap(OlapConnection.class);
}
开发者ID:OSBI,项目名称:mondrian,代码行数:17,代码来源:TestContext.java
示例4: openQuery
import mondrian.olap.DriverManager; //导入依赖的package包/类
public void openQuery() throws KettleDatabaseException {
String connectString = "Provider=mondrian;" +
"Jdbc='"+space.environmentSubstitute(databaseMeta.getURL())+"';"+
"Catalog='"+space.environmentSubstitute(catalog)+"';"+
"JdbcDrivers="+space.environmentSubstitute(databaseMeta.getDriverClass())+";";
if (!Const.isEmpty(databaseMeta.getUsername())) {
connectString+="JdbcUser="+space.environmentSubstitute(databaseMeta.getUsername())+";";
}
if (!Const.isEmpty(databaseMeta.getPassword())) {
connectString+="JdbcPassword="+space.environmentSubstitute(databaseMeta.getPassword())+";";
}
connection = DriverManager.getConnection(connectString, null);
query = connection.parseQuery(queryString);
result = connection.execute(query);
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:18,代码来源:MondrianHelper.java
示例5: loadConvertedSchemaInMondrian
import mondrian.olap.DriverManager; //导入依赖的package包/类
@Test
public void loadConvertedSchemaInMondrian() throws Exception {
// temp file to hold conversion output
File tmpFile = File.createTempFile("output_foodmart_", ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
// do conversion on SSAS dump of foodmart
List<Document> docs = ConversionUtil.generateMondrianDocsFromSSASSchema(getClass().getResourceAsStream(
"/analysis_server_output.xml")); //$NON-NLS-1$
// save conversion to file
FileUtils.writeStringToFile(tmpFile, docs.get(0).asXML());
// load file into Mondrian
String connectString = getTestProperty("test.mondrian.foodmart.connectString", //$NON-NLS-1$
getTestProperty("test.mondrian.foodmart.connectString.provider"), //$NON-NLS-1$
getTestProperty("test.mondrian.foodmart.connectString.jdbc"), //$NON-NLS-1$
getTestProperty("test.mondrian.foodmart.connectString.username"), //$NON-NLS-1$
getTestProperty("test.mondrian.foodmart.connectString.password"), //$NON-NLS-1$
tmpFile.getPath());
DriverManager.getConnection(connectString, null).getSchema();
}
开发者ID:pentaho,项目名称:pentaho-aggdesigner,代码行数:23,代码来源:SsasToMondrianTest.java
示例6: getConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
/**
* Gets a Mondrian connection, creating a new one if fresh is true.
*
* @return mondrian Connection.
*/
public synchronized Connection getConnection(boolean fresh) {
// FIXME: fresh is currently ignored.
if (this.connectString == null) {
makeConnectString();
}
if (this.connection == null) {
this.connection =
DriverManager.getConnection(this.connectString, null);
}
return this.connection;
}
开发者ID:OSBI,项目名称:mondrian,代码行数:17,代码来源:CmdRunner.java
示例7: getOlapConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
/**
* Gets an olap4j connection, creating a new one if fresh is true.
*
* @return mondrian Connection.
*/
public synchronized OlapConnection getOlapConnection() throws SQLException {
if (this.connectString == null) {
makeConnectString();
}
final String olapConnectString = "jdbc:mondrian:" + connectString;
final java.sql.Connection jdbcConnection =
java.sql.DriverManager.getConnection(olapConnectString);
// Cast to OlapWrapper lets code work on JDK1.5, before java.sql.Wrapper
//noinspection RedundantCast
return ((OlapWrapper) jdbcConnection).unwrap(OlapConnection.class);
}
开发者ID:OSBI,项目名称:mondrian,代码行数:17,代码来源:CmdRunner.java
示例8: getConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
OlapConnection getConnection(
CatalogInfo catalogInfo,
MondrianServer server,
String roleName,
Properties props)
throws SQLException
{
String connectString = catalogInfo.olap4jConnectString;
// Save the server for the duration of the call to 'getConnection'.
final LockBox.Entry entry =
MondrianServerRegistry.INSTANCE.lockBox.register(server);
final Properties properties = new Properties();
properties.setProperty(
RolapConnectionProperties.Instance.name(),
entry.getMoniker());
if (roleName != null) {
properties.setProperty(
RolapConnectionProperties.Role.name(),
roleName);
}
properties.putAll(props);
// Make sure we load the Mondrian driver into
// the ClassLoader.
try {
ClassResolver.INSTANCE.forName(
MondrianOlap4jDriver.class.getName(), true);
} catch (ClassNotFoundException e) {
throw new OlapException("Cannot find mondrian olap4j driver.");
}
final java.sql.Connection connection =
java.sql.DriverManager.getConnection(connectString, properties);
return ((OlapWrapper) connection).unwrap(OlapConnection.class);
}
开发者ID:OSBI,项目名称:mondrian,代码行数:37,代码来源:FileRepository.java
示例9: checkSchemaFile
import mondrian.olap.DriverManager; //导入依赖的package包/类
/**
* Check if schema file is valid by initiating a mondrian connection.
*/
private void checkSchemaFile(File file) {
try {
// this connection parses the catalog file which if invalid will
// throw exception
PropertyList list = new PropertyList();
list.put("Provider", "mondrian");
list.put("Jdbc", jdbcConnectionUrl);
list.put("Catalog", file.toURI().toURL().toString());
list.put("JdbcDrivers", jdbcDriverClassName);
if (jdbcUsername != null && jdbcUsername.length() > 0) {
list.put("JdbcUser", jdbcUsername);
}
if (jdbcPassword != null && jdbcPassword.length() > 0) {
list.put("JdbcPassword", jdbcPassword);
}
DriverManager.getConnection(list, null);
} catch (Exception ex) {
LOGGER.error(
"Exception : Schema file "
+ file.getAbsolutePath()
+ " is invalid."
+ ex.getMessage(), ex);
} catch (Error err) {
LOGGER.error(
"Error : Schema file "
+ file.getAbsolutePath()
+ " is invalid."
+ err.getMessage(), err);
}
}
开发者ID:OSBI,项目名称:mondrian,代码行数:35,代码来源:Workbench.java
示例10: testSchema3withVersion
import mondrian.olap.DriverManager; //导入依赖的package包/类
public void testSchema3withVersion() {
TestContext testContext =
TestContext.instance().withSchema(SCHEMA_3_VHEADER + SCHEMA_3_BODY);
Util.PropertyList connectInfo =
testContext.getConnectionProperties();
Connection conn = DriverManager.getConnection(connectInfo, null);
assertNotNull(conn);
conn.close();
}
开发者ID:OSBI,项目名称:mondrian,代码行数:10,代码来源:SchemaVersionTest.java
示例11: testSchema3noVersion
import mondrian.olap.DriverManager; //导入依赖的package包/类
public void testSchema3noVersion() {
TestContext testContext =
TestContext.instance().withSchema(SCHEMA_3_HEADER + SCHEMA_3_BODY);
Util.PropertyList connectInfo =
testContext.getConnectionProperties();
Connection conn = DriverManager.getConnection(connectInfo, null);
assertNotNull(conn);
conn.close();
}
开发者ID:OSBI,项目名称:mondrian,代码行数:10,代码来源:SchemaVersionTest.java
示例12: testSchema4withVersion
import mondrian.olap.DriverManager; //导入依赖的package包/类
public void testSchema4withVersion() {
TestContext testContext =
TestContext.instance().withSchema(SCHEMA_4_HEADER + SCHEMA_4_BODY);
Util.PropertyList connectInfo =
testContext.getConnectionProperties();
try {
Connection conn = DriverManager.getConnection(connectInfo, null);
conn.close();
Assert.fail("No exception thrown for version 4 schema.");
} catch (MondrianException e) {
assertTrue(e.getMessage().contains("Schema version"));
}
}
开发者ID:OSBI,项目名称:mondrian,代码行数:14,代码来源:SchemaVersionTest.java
示例13: testSchema4noVersion
import mondrian.olap.DriverManager; //导入依赖的package包/类
public void testSchema4noVersion() {
TestContext testContext =
TestContext.instance().withSchema(
SCHEMA_4_NVHEADER + SCHEMA_4_BODY);
Util.PropertyList connectInfo =
testContext.getConnectionProperties();
try {
Connection conn = DriverManager.getConnection(connectInfo, null);
conn.close();
Assert.fail("No exception thrown for version 4 schema.");
} catch (MondrianException e) {
assertTrue(e.getMessage().contains("Schema version"));
}
}
开发者ID:OSBI,项目名称:mondrian,代码行数:15,代码来源:SchemaVersionTest.java
示例14: openQuery
import mondrian.olap.DriverManager; //导入依赖的package包/类
public void openQuery() throws KettleDatabaseException {
connection = null;
if (databaseMeta.getAccessType() == DatabaseMeta.TYPE_ACCESS_JNDI){
DataSource dataSource = DataSourceProviderFactory.getDataSourceProviderInterface().getNamedDataSource(databaseMeta.getDatabaseName());
mondrian.olap.Util.PropertyList propList = new mondrian.olap.Util.PropertyList();
propList.put("Provider", "mondrian");
propList.put("Catalog", space.environmentSubstitute(catalog));
connection = DriverManager.getConnection(propList, null, dataSource);
}
else{
String connectString = "Provider=mondrian;" +
"Jdbc='"+space.environmentSubstitute(databaseMeta.getURL())+"';"+
"Catalog='"+space.environmentSubstitute(catalog)+"';"+
"JdbcDrivers="+space.environmentSubstitute(databaseMeta.getDriverClass())+";";
if (!Const.isEmpty(databaseMeta.getUsername())) {
connectString+="JdbcUser="+space.environmentSubstitute(databaseMeta.getUsername())+";";
}
if (!Const.isEmpty(databaseMeta.getPassword())) {
connectString+="JdbcPassword="+space.environmentSubstitute(databaseMeta.getPassword())+";";
}
connection = DriverManager.getConnection(connectString, null);
}
query = connection.parseQuery(queryString);
result = connection.execute(query);
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:32,代码来源:MondrianHelper.java
示例15: valueBound
import mondrian.olap.DriverManager; //导入依赖的package包/类
/**
* create a new connection to Mondrian
*/
public void valueBound(HttpSessionBindingEvent ev) {
String connectString =
servletContext.getInitParameter("connectString");
LOGGER.debug("connectString: " + connectString);
this.connection =
DriverManager.getConnection(
connectString,
new ServletContextCatalogLocator(servletContext));
if (this.connection == null) {
throw new RuntimeException(
"No ROLAP connection from connectString: "
+ connectString);
}
}
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:18,代码来源:ResultCache.java
示例16: Test
import mondrian.olap.DriverManager; //导入依赖的package包/类
Test(String[] args)
{
pw = new PrintWriter(System.out, true);
String connectString =
"Data Source=LOCALHOST;Provider=msolap;Catalog=Foodmart";
connection =
(RolapConnection) DriverManager.getConnection(connectString, null);
}
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:9,代码来源:Test.java
示例17: checkSchemaFile
import mondrian.olap.DriverManager; //导入依赖的package包/类
/**
* Check if schema file is valid by initiating a mondrian connection.
*/
private void checkSchemaFile(File file) {
try {
// this connection parses the catalog file which if invalid will
// throw exception
PropertyList list = new PropertyList();
list.put("Provider", "mondrian");
list.put("Jdbc", jdbcConnectionUrl);
list.put("Catalog", file.toURL().toString());
list.put("JdbcDrivers", jdbcDriverClassName);
if (jdbcUsername != null && jdbcUsername.length() > 0) {
list.put("JdbcUser", jdbcUsername);
}
if (jdbcPassword != null && jdbcPassword.length() > 0) {
list.put("JdbcPassword", jdbcPassword);
}
// clear cache before connecting
AggregationManager.instance().getCacheControl(null)
.flushSchemaCache();
DriverManager.getConnection(list, null);
} catch (Exception ex) {
LOGGER.error(
"Exception : Schema file "
+ file.getAbsolutePath()
+ " is invalid."
+ ex.getMessage(), ex);
} catch (Error err) {
LOGGER.error(
"Error : Schema file "
+ file.getAbsolutePath()
+ " is invalid."
+ err.getMessage(), err);
}
}
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:39,代码来源:Workbench.java
示例18: getFoodMartConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
/**
* Returns a connection to the FoodMart database.
*/
public synchronized Connection getFoodMartConnection() {
if (foodMartConnection == null) {
foodMartConnection =
DriverManager.getConnection(
getFoodMartConnectionProperties(),
null);
}
return foodMartConnection;
}
开发者ID:Twixer,项目名称:mondrian-3.1.5,代码行数:13,代码来源:TestContext.java
示例19: executeOlap4jXmlaQuery
import mondrian.olap.DriverManager; //导入依赖的package包/类
public CellSet executeOlap4jXmlaQuery(String queryString)
throws SQLException
{
String schema = getConnectionProperties()
.get(RolapConnectionProperties.CatalogContent.name());
if (schema == null) {
schema = getRawSchema();
}
// TODO: Need to better handle semicolons in schema content.
// Util.parseValue does not appear to allow escaping them.
schema = schema.replace(""", "").replace(";", "");
String Jdbc = getConnectionProperties()
.get(RolapConnectionProperties.Jdbc.name());
String cookie = XmlaOlap4jDriver.nextCookie();
Map<String, String> catalogs = new HashMap<String, String>();
catalogs.put("FoodMart", "");
XmlaOlap4jDriver.PROXY_MAP.put(
cookie, new MondrianInprocProxy(
catalogs,
"jdbc:mondrian:Server=http://whatever;"
+ "Jdbc=" + Jdbc + ";TestProxyCookie="
+ cookie
+ ";CatalogContent=" + schema));
try {
Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
} catch (ClassNotFoundException e) {
throw new RuntimeException("oops", e);
}
Properties info = new Properties();
info.setProperty(
XmlaOlap4jDriver.Property.CATALOG.name(), "FoodMart");
java.sql.Connection connection = java.sql.DriverManager.getConnection(
"jdbc:xmla:Server=http://whatever;Catalog=FoodMart;TestProxyCookie="
+ cookie,
info);
OlapConnection olapConnection =
connection.unwrap(OlapConnection.class);
OlapStatement statement = olapConnection.createStatement();
return statement.executeOlapQuery(queryString);
}
开发者ID:OSBI,项目名称:mondrian,代码行数:43,代码来源:TestContext.java
示例20: getMondrianConnection
import mondrian.olap.DriverManager; //导入依赖的package包/类
public mondrian.olap.Connection getMondrianConnection() throws Exception {
if (mondrianConnection == null)
{
JDBCConnection con = getJDBCConnection();
// Force opening connection...
ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
try {
Connection conn = null;
try {
conn = con.getConnection();
if (conn == null) throw new Exception("No DB connection");
} finally {
// Clean up
if( conn!=null ) try{ conn.close(); } catch(Exception e) { /* anyone really care? */ }
}
Thread.currentThread().setContextClassLoader( IReportManager.getReportClassLoader());
Util.PropertyList props = new Util.PropertyList();
props.put("Catalog", getCatalogUri());
props.put("Provider", "mondrian");
props.put("Locale", Locale.getDefault().getLanguage());
SimpleSQLDataSource ds = new SimpleSQLDataSource(con);
mondrianConnection = DriverManager.getConnection(props, null, ds);
/*
mondrianConnection = DriverManager.getConnection(
"Provider=mondrian;" +
"JdbcDrivers=" + escapeProperty( con.getJDBCDriver() ) + ";" +
"Jdbc=" + escapeProperty( con.getUrl() ) + ";" +
"JdbcUser=" + escapeProperty( con.getUsername() ) + ";" +
"JdbcPassword=" + escapeProperty( con.getPassword() ) + ";" +
"Catalog=" + escapeProperty( getCatalogUri() ) + ";",
null, false);
*/
} catch (Exception ex) {
ex.printStackTrace();
throw ex;
}
Thread.currentThread().setContextClassLoader( originalCL);
}
usedby++;
return mondrianConnection;
}
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:54,代码来源:MondrianConnection.java
注:本文中的mondrian.olap.DriverManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论