当前位置: 首页>>代码示例>>Java>>正文


Java HikariDataSource.addDataSourceProperty方法代码示例

本文整理汇总了Java中com.zaxxer.hikari.HikariDataSource.addDataSourceProperty方法的典型用法代码示例。如果您正苦于以下问题:Java HikariDataSource.addDataSourceProperty方法的具体用法?Java HikariDataSource.addDataSourceProperty怎么用?Java HikariDataSource.addDataSourceProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.zaxxer.hikari.HikariDataSource的用法示例。


在下文中一共展示了HikariDataSource.addDataSourceProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LoggingModule

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
public LoggingModule() throws DataException {
	setInstance(this);
	YamlConfiguration bukkitYml = YamlConfiguration
			.loadConfiguration(new File(Bukkit.getWorldContainer().getAbsoluteFile(), "bukkit.yml"));
	DB_URL = KingdomFactionsPlugin.getInstance().getDataManager().getString("Database.Logging.url").replace("{NAME}", DB_NAME);
	USERNAME = bukkitYml.getString("database.username");
	PASSWORD = bukkitYml.getString("database.password");
	datasource = new HikariDataSource();
	datasource.setMaximumPoolSize(25);
	datasource.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
	datasource.addDataSourceProperty("url", DB_URL);
	datasource.addDataSourceProperty("port", 3306);
	datasource.addDataSourceProperty("databaseName", DB_NAME);
	datasource.addDataSourceProperty("user", USERNAME);
	datasource.addDataSourceProperty("password", PASSWORD);
	insertQuery("CREATE DATABASE IF NOT EXISTS " + DB_NAME);
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:18,代码来源:LoggingModule.java

示例2: MySQLModule

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
public MySQLModule() {
	setInstance(this);
	YamlConfiguration bukkitYml = YamlConfiguration
			.loadConfiguration(new File(Bukkit.getWorldContainer().getAbsoluteFile(), "bukkit.yml"));
	DB_URL = bukkitYml.getString("database.url").replace("{NAME}", DB_NAME);
	USERNAME = bukkitYml.getString("database.username");
	PASSWORD = bukkitYml.getString("database.password");
	datasource = new HikariDataSource();
	datasource.setMaximumPoolSize(25);
	datasource.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
	datasource.addDataSourceProperty("url", DB_URL);
	datasource.addDataSourceProperty("port", 3306);
	datasource.addDataSourceProperty("databaseName", DB_NAME);
	datasource.addDataSourceProperty("user", USERNAME);
	datasource.addDataSourceProperty("password", PASSWORD);
	insertQuery("CREATE DATABASE IF NOT EXISTS " + DB_NAME);
	new PlayerDatabase();
	new FactionDatabase();
	new NexusDatabase();
	new KingdomDatabase();
	new BuildingDatabase();
	new FactionHomeDatabase();
	
	new ShopDatabase();
	new ShopLogDatabase();
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:27,代码来源:MySQLModule.java

示例3: buildH2Datasource

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
private static HikariDataSource buildH2Datasource() {
	HikariDataSource ds = new HikariDataSource();
	ds.addDataSourceProperty("cachePrepStmts", true);
	ds.addDataSourceProperty("prepStmtCacheSize", 250);
	ds.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
	ds.addDataSourceProperty("useServerPrepStmts", true);
	ds.setMaximumPoolSize(3);
	ds.setConnectionTimeout(5000);
	ds.setJdbcUrl("jdbc:h2:mem:DBName;MODE=MYSQL;DB_CLOSE_DELAY=-1;TRACE_LEVEL_SYSTEM_OUT=0");
	ds.setDriverClassName("org.h2.Driver");
	ds.setUsername("sa");
	ds.setPassword("");
	return ds;
}
 
开发者ID:drinkjava2,项目名称:jDialects,代码行数:15,代码来源:DialectTest.java

示例4: create

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
public HikariDataSource create() {
	HikariDataSource ds = new HikariDataSource();
	ds.addDataSourceProperty("cachePrepStmts", true);
	ds.addDataSourceProperty("prepStmtCacheSize", 250);
	ds.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
	ds.addDataSourceProperty("useServerPrepStmts", true);
	ds.setMaximumPoolSize(3);
	ds.setConnectionTimeout(5000);
	this.setPreDestory("close");// jBeanBox will close pool
	return ds;
}
 
开发者ID:drinkjava2,项目名称:jDialects,代码行数:12,代码来源:DataSourceConfig.java

示例5: create

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
public HikariDataSource create() {
	HikariDataSource ds = new HikariDataSource();
	ds.addDataSourceProperty("cachePrepStmts", true);
	ds.addDataSourceProperty("prepStmtCacheSize", 250);
	ds.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
	ds.addDataSourceProperty("useServerPrepStmts", true);
	ds.setMaximumPoolSize(10);
	ds.setConnectionTimeout(5000);
	this.setPreDestory("close");// jBeanBox will close pool
	return ds;
}
 
开发者ID:drinkjava2,项目名称:jTransactions,代码行数:12,代码来源:DataSourceConfig.java

示例6: register

import com.zaxxer.hikari.HikariDataSource; //导入方法依赖的package包/类
@Override
public boolean register() {
    if (IsRegistered) {
        return HAS_REGISTERED;
    }

    HikariDataSource ds = new HikariDataSource();

    //basic config
    ds.setJdbcUrl(jdbcURL);
    ds.setDriverClassName(jdbcDriver);
    ds.setUsername(jdbcUsername);
    ds.setPassword(jdbcPassword);

    //custom config
    ds.setAutoCommit(autoCommit);
    ds.setConnectionTimeout(connectionTimeout);
    ds.setIdleTimeout(idleTimeout);
    ds.setMaxLifetime(maxLifetime);
    ds.setMaximumPoolSize(maximumPoolSize);
    ds.setValidationTimeout(validationTimeout);
    ds.setLeakDetectionThreshold(leakDetectionThreshold);

    if (!StrUtil.isBlank(poolName)) {
        ds.setPoolName(poolName);
    }

    if (!StrUtil.isBlank(catalog)) {
        ds.setCatalog(catalog);
    }

    if (!StrUtil.isBlank(connectionInitSql)) {
        ds.setConnectionInitSql(connectionInitSql);
    }

    if (!StrUtil.isBlank(transactionIsolation)) {
        ds.setTransactionIsolation(transactionIsolation);
    }

    if (jdbcURL.contains(":mysql:")) {
        ds.addDataSourceProperty("cachePrepStmts", "true");
        ds.addDataSourceProperty("prepStmtCacheSize", "250");
        ds.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
        ds.addDataSourceProperty("useServerPrepStmts", "true");
    }

    setDataSource(ds);
    setIsRegistered(HAS_REGISTERED);
    return HAS_REGISTERED;
}
 
开发者ID:xujiajun,项目名称:tastjava,代码行数:51,代码来源:HikariCPProvider.java


注:本文中的com.zaxxer.hikari.HikariDataSource.addDataSourceProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。