我是 c3op 的新手,对 : 的使用感到困惑
c3p0.idle_test_period
在此链接中:HowTo configure the C3P0 connection pool
idleTestPeriod : Must be set in hibernate.cfg.xml (or hibernate.properties), Hibernate default:
0, If this is a number greater than 0, c3p0 will test all idle, pooled but unchecked-out
connections, every this number of seconds.
这种测试(idel,pooled connections)的目的是什么,c3p0.idle_test_period和c3p0.timeout有什么关系?
最佳答案
数据库服务器可能会在一定时间后关闭其端的连接 - 导致您的应用程序出现错误,因为它会尝试在服务器端不再可用的连接上发送查询。
为了避免这种情况,您可以让池定期检查连接(想想 ping)的有效性。这就是 idle_test_period
的用途。
timeout
是池将从池中删除连接的时间跨度,因为该连接有一段时间未 check out (使用)并且池包含的连接数多于 c3pO.min_size
.
关于java - 使用c3p0.idle_test_period。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10175957/