當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicDataSource.setConnectionProperties方法代碼示例

本文整理匯總了Java中org.apache.commons.dbcp2.BasicDataSource.setConnectionProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicDataSource.setConnectionProperties方法的具體用法?Java BasicDataSource.setConnectionProperties怎麽用?Java BasicDataSource.setConnectionProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.dbcp2.BasicDataSource的用法示例。


在下文中一共展示了BasicDataSource.setConnectionProperties方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dataSource

import org.apache.commons.dbcp2.BasicDataSource; //導入方法依賴的package包/類
@Bean
public BasicDataSource dataSource() throws URISyntaxException {
    URI dbUri = new URI(System.getenv("DATABASE_URL"));

    String username = dbUri.getUserInfo().split(":")[0];
    String password = dbUri.getUserInfo().split(":")[1];
    String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath();

    BasicDataSource basicDataSource = new BasicDataSource();
    basicDataSource.setUrl(dbUrl);
    basicDataSource.setUsername(username);
    basicDataSource.setPassword(password);
    basicDataSource.setConnectionProperties("ssl=true;sslfactory=org.postgresql.ssl.NonValidatingFactory;");

    return basicDataSource;
}
 
開發者ID:allegrotech-umk,項目名稱:wildsnake-api,代碼行數:17,代碼來源:ProdDbConfig.java

示例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);
}
 
開發者ID:PkayJava,項目名稱:MBaaS,代碼行數:17,代碼來源:Serializable.java

示例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);
}
 
開發者ID:PkayJava,項目名稱:MBaaS,代碼行數:20,代碼來源:Source.java

示例4: buildDatasource

import org.apache.commons.dbcp2.BasicDataSource; //導入方法依賴的package包/類
DataSource buildDatasource() throws Exception{
  if (getDataSource() != null) {
    return getDataSource();
  } else {
    BasicDataSource basicDataSource = new BasicDataSource();
    basicDataSource.setDriverClassName(getDriverClassName());
    basicDataSource.setUrl(getUrl());
    basicDataSource.setUsername(getUsername());
    basicDataSource.setPassword(getPassword());
    if (getConnectionProperties() != null) {
      basicDataSource.setConnectionProperties(getConnectionProperties());
    }
    return basicDataSource;
  }
}
 
開發者ID:apache,項目名稱:beam,代碼行數:16,代碼來源:JdbcIO.java


注:本文中的org.apache.commons.dbcp2.BasicDataSource.setConnectionProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。