我有几个关于JDBC连接的问题。
谢谢
发布于 2014-10-06 16:09:53
发布于 2018-12-24 10:01:28
如果使用的是DBCP2,则可以打印未关闭的活动连接。在这里,类正在扩展BasicDataSource,并重写getConnection方法。
try {String className = Thread.currentThread().getStackTrace()[2].getClassName();
LOG.info("For class :: " + className + " || " + "max total connections :: " + super.getMaxTotal()+ " || " +" Active Connections count :: "+ super.getNumActive());
connection = super.getConnection();
}catch (SQLException e) {
LOG.error("SQL Exception in Connection", e);
}https://stackoverflow.com/questions/26219441
复制相似问题