diff --git a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/DruidPoolBuilder.java b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/DruidPoolBuilder.java index 7bbac0faf88b56db824100b81aa2b97094470d06..e9fc496af34be38417f5d5c7a01bbda9c972044f 100644 --- a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/DruidPoolBuilder.java +++ b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/DruidPoolBuilder.java @@ -1,14 +1,12 @@ 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; diff --git a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/HikariCpBuilder.java b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/HikariCpBuilder.java index acf18bf999aad94722f0dde8d63adfacee41375b..5cfe7e6e6a00fabd67ebd585f0b40ee6276cc2b0 100644 --- a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/HikariCpBuilder.java +++ b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/demo/pool/HikariCpBuilder.java @@ -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