使用c3p0.idle_test_period

【字号: 日期:2024-04-02浏览:40作者:雯心
(adsbygoogle = window.adsbygoogle || []).push({}); 如何解决使用c3p0.idle_test_period?

在一定时间后,数据库服务器可能会在其一侧关闭连接-导致您的应用程序出现错误,因为它会尝试在服务器端不再可用的连接上发送查询。

为了避免这种情况,您可以让池定期检查连接的有效性(请考虑一下ping)以确认其有效性。这idle_test_period是为了什么。

timeout是池将在其后从池中删除连接的时间跨度,因为一段时间以来未检出(使用)该连接,并且该池包含的连接数超过c3pO.min_size。

解决方法

我是c3op的新手,对使用感到困惑:

c3p0.idle_test_period

在此链接中:如何配置C3P0连接池

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.

这种测试(空闲,池连接)的目的是什么,以及c3p0.idle_test_period和c3p0.timeout之间的关系?

相关文章: