对于其中一个应用程序,我使用的是c3p0 + hibernate。我在hibernate配置中配置的属性如下所示:
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.connection.release_mode=after_transaction
c3p0.max_size=15
c3p0.min_size=4
c3p0.timeout=60
c3p0.max_statements=0
c3p0.acquire_increment=3
c3p0.idle_test_period=60
c3p0.acquire_retry_attempts=3
c3p0.checkout.timeout=6000
数据库处于远程状态,每当数据库连接断开时,从应用程序触发的任何数据库查询都需要花费大量时间才能返回调用方法。