提交 ee236c20 编写于 作者: Z zyyang

change

上级 1ceacaaf
package com.taosdata.demo.pool;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import javax.sql.DataSource;
import java.util.Properties;
public class DruidPoolBuilder {
public static DataSource getDataSource(String host, int poolSize) throws Exception {
public static DataSource getDataSource(String host, int poolSize) {
final String url = "jdbc:TAOS://" + host + ":6030";
DruidDataSource dataSource = new DruidDataSource();
......@@ -18,9 +16,9 @@ public class DruidPoolBuilder {
dataSource.setUsername("root");
dataSource.setPassword("taosdata");
// pool configurations
dataSource.setInitialSize(10);
dataSource.setMinIdle(10);
dataSource.setMaxActive(10);
dataSource.setInitialSize(poolSize);
dataSource.setMinIdle(poolSize);
dataSource.setMaxActive(poolSize);
dataSource.setMaxWait(30000);
dataSource.setValidationQuery("select server_status()");
return dataSource;
......
......@@ -15,8 +15,8 @@ public class HikariCpBuilder {
config.setUsername("root");
config.setPassword("taosdata");
// pool configurations
config.setMinimumIdle(3); //minimum number of idle connection
config.setMaximumPoolSize(10); //maximum number of connection in the pool
config.setMinimumIdle(poolSize); //minimum number of idle connection
config.setMaximumPoolSize(poolSize); //maximum number of connection in the pool
config.setConnectionTimeout(30000); //maximum wait milliseconds for get connection from pool
config.setMaxLifetime(0); // maximum life time for each connection
config.setIdleTimeout(0); // max idle time for recycle idle connection
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册