本文整理匯總了Java中org.apache.commons.dbcp2.BasicDataSource.setDefaultTransactionIsolation方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicDataSource.setDefaultTransactionIsolation方法的具體用法?Java BasicDataSource.setDefaultTransactionIsolation怎麽用?Java BasicDataSource.setDefaultTransactionIsolation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.dbcp2.BasicDataSource
的用法示例。
在下文中一共展示了BasicDataSource.setDefaultTransactionIsolation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newDataSource
import org.apache.commons.dbcp2.BasicDataSource; //導入方法依賴的package包/類
private static BasicDataSource newDataSource(String id, String driver, String db, String user, String pswd, int initial, int max)
{
LOG.info("Initializing a fresh pool for Id=" + id + ", DB=" + db + ", User=" + user + ", and Pswd=Shhhhhhh!");
BasicDataSource BDS = new BasicDataSource();
BDS.setDriverClassName(driver);
BDS.setUrl(db);
if (TextUtil.isNullOrEmpty(pswd) == false && TextUtil.isNullOrEmpty(user) == false)
{
BDS.setUsername(user);
BDS.setPassword(pswd);
}
BDS.setInitialSize(initial);
BDS.setMaxTotal(max);
BDS.setDefaultAutoCommit(false);
BDS.setDefaultTransactionIsolation(java.sql.Connection.TRANSACTION_READ_COMMITTED);
BDS.setDefaultQueryTimeout(20000);
return BDS;
}
示例2: main
import org.apache.commons.dbcp2.BasicDataSource; //導入方法依賴的package包/類
/**
* Main function, starts the jetty server.
*
* @param args
*/
public static void main(String[] args) throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(Database.DRIVER);
dataSource.setUsername(Database.USER);
dataSource.setPassword(Database.PASSWORD);
dataSource.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
dataSource.setConnectionProperties(Database.PROPERTIES);
dataSource.setUrl(Database.URL);
clean(dataSource, "address", "assignment", "attendance", "calendar", "certification", "class", "course", "enrollment", "examination", "examination_master", "foundation_examination", "link", "person", "room", "subject");
generatePerson(dataSource, 200);
}
示例3: main
import org.apache.commons.dbcp2.BasicDataSource; //導入方法依賴的package包/類
/**
* Main function, starts the jetty server.
*
* @param args
*/
public static void main(String[] args) throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(Database.DRIVER);
dataSource.setUsername(Database.USER);
dataSource.setPassword(Database.PASSWORD);
dataSource.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
dataSource.setConnectionProperties(Database.PROPERTIES);
dataSource.setUrl(Database.URL);
clean(dataSource, "address", "assignment", "attendance", "calendar", "certification", "class", "course", "enrollment", "examination", "examination_master", "foundation_examination", "link", "person", "room", "subject");
generatePerson(dataSource, 200);
generateFoundationExamination(dataSource, 300);
submitFoundationExaminationResult(dataSource, 0.7f);
goEnrollment(dataSource, 0.4f);
}