本文整理汇总了Java中org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40类的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedConnectionPoolDataSource40类的具体用法?Java EmbeddedConnectionPoolDataSource40怎么用?Java EmbeddedConnectionPoolDataSource40使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EmbeddedConnectionPoolDataSource40类属于org.apache.derby.jdbc包,在下文中一共展示了EmbeddedConnectionPoolDataSource40类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataSource
import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40; //导入依赖的package包/类
/**
* Get a connection pool data source for use by Java DB storage engines
* @param dbPath The path where the db will be located
* @param memory whether to actually use a memory database
* @return the {@link ConnectionPoolDataSource}
*/
public static ConnectionPoolDataSource getDataSource(String dbPath,
boolean memory) {
EmbeddedConnectionPoolDataSource40 ds =
new EmbeddedConnectionPoolDataSource40();
if (memory) {
ds.setDatabaseName("memory:SyncDB");
} else {
String path = "SyncDB";
if (dbPath != null) {
File f = new File(dbPath);
f = new File(dbPath,"SyncDB");
path = f.getAbsolutePath();
}
ds.setDatabaseName(path);
}
ds.setCreateDatabase("create");
ds.setUser("floodlight");
ds.setPassword("floodlight");
return ds;
}
示例2: getDataSource
import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40; //导入依赖的package包/类
/**
* Get a connection pool data source for use by Java DB storage engines
* @param dbPath The path where the db will be located
* @param memory whether to actually use a memory database
* @return the {@link ConnectionPoolDataSource}
*/
public static ConnectionPoolDataSource getDataSource(String dbPath,
boolean memory) {
EmbeddedConnectionPoolDataSource40 ds =
new EmbeddedConnectionPoolDataSource40();
if (memory) {
ds.setDatabaseName("memory:SyncDB");
} else {
String path = "SyncDB";
if (dbPath != null) {
File f = new File(dbPath);
f = new File(dbPath,"SyncDB");
path = f.getAbsolutePath();
}
ds.setDatabaseName(path);
}
ds.setCreateDatabase("create");
ds.setUser("floodlight");
ds.setPassword("floodlight");
return ds;
}