测试环境与前相同
jar包位置: https://github.com/Chris2018998/BeeCP/blob/master/doc/temp/beecp-3.0.0.jar
日志文件: https://github.com/Chris2018998/BeeCP/blob/master/doc/temp/JDBCPool-20201013.log
连接池配置源码:
import cn.beecp.test.Link;
import cn.beecp.BeeDataSource;
import cn.beecp.BeeDataSourceConfig;
public class BeeCP_C {
public static BeeDataSource createDataSource() throws Exception{
BeeDataSourceConfig config = new BeeDataSourceConfig();
config.setDriverClassName(Link.JDBC_DRIVER);
config.setJdbcUrl(Link.JDBC_URL);
config.setUsername(Link.JDBC_USER);
config.setPassword(Link.JDBC_PASSWORD);
config.setMaxActive(Link.POOL_MAX_ACTIVE);
config.setInitialSize(Link.POOL_INIT_SIZE);
config.setMaxWait(Link.REQUEST_TIMEOUT);
config.setConnectionTestSQL("select 1 from dual");
config.setDefaultAutoCommit(false);
config.setTraceStatement(true);
config.addConnectProperty("cachePrepStmts", "true");
config.addConnectProperty("prepStmtCacheSize", "50");
config.addConnectProperty("prepStmtCacheSqlLimit", "2048");
config.addConnectProperty("useServerPrepStmts", "true");
return new BeeDataSource(config);
}
}
源码出处: https://github.com/Chris2018998/PoolPerformance
来源:oschina
链接:https://my.oschina.net/u/3918073/blog/4675281