使用c3p0.idle_test_period。 [英] The use of c3p0.idle_test_period.
问题描述
我是c3op的新手,并且对使用以下内容感到困惑:
c3p0.idle_test_period
code>
在此链接中:如何配置C3P0连接池
idleTestPeriod:必须在hibernate.cfg.xml(或hibernate.properties)中设置,Hibernate默认值:
0,如果这是一个大于0的数字,c3p0将测试所有空闲的,汇集的但未经检查的
连接,每隔数秒。
这种测试的目的是什么(idel,pooled connections),以及c3p0 .idle_test_period和c3p0.timeout?
数据库服务器可能会在一定时间后关闭连接,在您的应用程序中出现一些错误,因为它会尝试在服务器端不再可用的连接上发送查询。
为了避免这种情况,您可以让池周期性地检查连接(想一想ping)的有效性。这就是 idle_test_period
的用途。
$ b
超时
是池在池中移除连接的时间段,因为连接不是(使用)一段时间,池中包含的连接数多于 c3pO.min_size
。
I'm new to c3op, and confused about the use of :
c3p0.idle_test_period
In this link : 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.
What is the purpose of this kind of test (idel, pooled connections), and the relationship between c3p0.idle_test_period and c3p0.timeout?
The database server may close a connection on its side after a certain amount of time - causing some error in your application, because it'll attempt to send a query on a connection which is no longer available on the server side.
In order to avoid this you can let the pool periodically check a connection (Think of a ping) for it's validity. This is what idle_test_period
is for.
timeout
is the timespan after which the pool will remove a connection from the pool, because the connection wasn't checked out (used) for a while and the pool contains more connections than c3pO.min_size
.
这篇关于使用c3p0.idle_test_period。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!