The use of c3p0.idle_test_period.

前端 未结 2 1878
[愿得一人]
[愿得一人] 2020-12-28 09:36

I\'m new to c3op, and confused about the use of :

c3p0.idle_test_period

In this link : HowTo configure the C3P0 connection pool

         


        
相关标签:
2条回答
  • 2020-12-28 10:13

    I think this setting is used in hibernate in order to validate pooled connection after every few seconds . Consider a scenario if on database side, password is changed. Hibernate already pooled connections on old password. So it is security breach having pool with wrong password.So when hibernate will validate after few seconds it . It will invalidate that pooled connection.

    0 讨论(0)
  • 2020-12-28 10:16

    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.

    0 讨论(0)
提交回复
热议问题