这些应用程序是否接受这些设置?我问是因为运行一两分钟后,尝试在池上调用getConnection时,我收到了boneCP异常。谢谢您的帮助。
如果您有100个工作线程,为什么将池限制为50个连接(分区数x每个分区的最大连接数,即您的情况为5 x 10)?
我是否无法正确关闭连接?
看起来还可以(但可以
connectionWatch根据提示启用,以查看警告的确切含义)。我个人关闭了我使用的所有资源,包括语句和结果集。以防万一,这是我使用的成语:
Connection conn = null;PreparedStatement pstmt = null;ResultSet rs = null;try { conn = pool.getConnection(); pstmt = conn.prepareStatement(SOME_SQL); pstmt.setFoo(1, foo); ... rs = pstmt.executeQuery(); ...} finally { if (rs != null) try { rs.close(); } catch (SQLException quiet) {} if (pstmt != null) try { pstmt.close(); } catch (SQLException quiet) {} if (conn != null) try { conn.close(); } catch (SQLException quiet) {}}您可以将以上调用归为一个实用程序类的静态方法。
或者,您可以
DbUnit.closeQuietly(Connection, Statement,ResultSet)从Commons
DbUtils使用已经完成的操作。



