当前位置: 首页>>代码示例>>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;未经允许,请勿转载。