本文整理匯總了Java中com.zaxxer.hikari.HikariConfig.setCatalog方法的典型用法代碼示例。如果您正苦於以下問題:Java HikariConfig.setCatalog方法的具體用法?Java HikariConfig.setCatalog怎麽用?Java HikariConfig.setCatalog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.zaxxer.hikari.HikariConfig
的用法示例。
在下文中一共展示了HikariConfig.setCatalog方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: HikariCpConfig
import com.zaxxer.hikari.HikariConfig; //導入方法依賴的package包/類
private HikariCpConfig(final JsonObject config) {
final HikariConfig hikariConfig = new HikariConfig();
// Init hikariCp, refer to offical site
// https://github.com/brettwooldridge/HikariCP
hikariConfig.setDriverClassName(config.getString("driverClassName"));
hikariConfig.setJdbcUrl(config.getString("jdbcUrl"));
hikariConfig.setUsername(config.getString("username"));
hikariConfig.setPassword(config.getString("password"));
hikariConfig.setCatalog(config.getString("catalog"));
// Init data source
final HikariDataSource dataSource = new HikariDataSource(hikariConfig);
this.pool = new HikariPool(dataSource);
}
示例2: build
import com.zaxxer.hikari.HikariConfig; //導入方法依賴的package包/類
@Override
public ManagedDataSource build(final MetricRegistry metricRegistry, final String name) {
final Properties properties = new Properties();
for (final Map.Entry<String, String> property : this.properties.entrySet()) {
properties.setProperty(property.getKey(), property.getValue());
}
final HikariConfig config = new HikariConfig();
config.setDataSourceProperties(properties);
if (this.autoCommitByDefault.isPresent()) {
config.setAutoCommit(this.autoCommitByDefault.get());
}
config.setCatalog(this.defaultCatalog);
if (this.readOnlyByDefault.isPresent()) {
config.setReadOnly(this.readOnlyByDefault.get());
}
config.setDriverClassName(this.driverClass);
config.setConnectionInitSql(this.initializationQuery);
config.setMaximumPoolSize(this.maxSize);
config.setMinimumIdle(this.minSize);
if (this.getMaxConnectionAge().isPresent()) {
config.setMaxLifetime(this.maxConnectionAge.toMilliseconds());
}
config.setPoolName(name);
config.setJdbcUrl(this.url);
config.setUsername(this.user);
config.setPassword(this.user != null && this.password == null ? "" : this.password);
config.setConnectionTestQuery(this.validationQuery);
if (this.getValidationQueryTimeout().isPresent()) {
config.setValidationTimeout(this.validationQueryTimeout.toMilliseconds());
}
if (this.defaultTransactionIsolation.isPresent()) {
config.setTransactionIsolation(this.defaultTransactionIsolation.get().toString());
}
return new ManagedPooledDataSource(config, metricRegistry);
}