本文整理匯總了Java中org.osjava.sj.loader.SJDataSource類的典型用法代碼示例。如果您正苦於以下問題:Java SJDataSource類的具體用法?Java SJDataSource怎麽用?Java SJDataSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SJDataSource類屬於org.osjava.sj.loader包,在下文中一共展示了SJDataSource類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setup
import org.osjava.sj.loader.SJDataSource; //導入依賴的package包/類
@BeforeClass
public static void setup() throws Exception {
// Configure Simple-JNDI for testing via System Properties
// System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
// System.setProperty("org.osjava.sj.root", "target/resources/test/config/");
// System.setProperty("org.osjava.sj.delimiter", "/");
Map<String,String> config = new HashMap<String,String>();
config.put("table.name","OS_PROPERTYENTRY");
config.put("col.globalKey","GLOBAL_KEY");
config.put("col.itemKey","ITEM_KEY");
config.put("col.itemType","ITEM_TYPE");
config.put("col.string","STRING_VALUE");
config.put("col.date","DATE_VALUE");
config.put("col.data","DATA_VALUE");
config.put("col.float","FLOAT_VALUE");
config.put("col.number","NUMBER_VALUE");
Map<String,Object> args = new HashMap<String,Object>();
args.put("globalKey","UnitTest");
DataSource dataSource = new SJDataSource("org.h2.Driver",
"jdbc:h2:mem:workflow;DB_CLOSE_DELAY=-1",
"sa", "",
new Properties());
args.put("datasource", dataSource);
jdbcPropertySet = new JDBCPropertySet(config, args);
}
示例2: getDbtypeByDatasource
import org.osjava.sj.loader.SJDataSource; //導入依賴的package包/類
/**
* 根據數據源獲取數據庫類型 <br/>
* @author jingma
* @param dataSource
* @return
*/
public static String getDbtypeByDatasource(DataSource dataSource) {
String dbType = null;
if(dataSource instanceof DruidDataSource){
dbType = JdbcUtils.getDbType(((DruidDataSource)dataSource).getUrl(), null);
}else if(dataSource instanceof SJDataSource){
dbType = JdbcUtils.getDbType(
((SJDataSource)dataSource).toString().split("::::")[1],
null);
}
return dbType;
}
示例3: getDbtypeByDatasource
import org.osjava.sj.loader.SJDataSource; //導入依賴的package包/類
/**
* 根據數據源獲取數據庫類型 <br/>
* @author jingma
* @param dataSource
* @return
*/
public static String getDbtypeByDatasource(DataSource dataSource) {
String dbType = null;
if(dataSource instanceof DruidDataSource){
dbType = ((DruidDataSource)dataSource).getDbType();
}else if(dataSource instanceof SJDataSource){
dbType = JdbcUtils.getDbType(
((SJDataSource)dataSource).toString().split("::::")[1],
null);
}
return dbType;
}