即使在配置连接池后,Hibernate连接也会在8小时后关闭

时间:2017-07-17 07:30:40

标签: mysql hibernate c3p0

我的c3p0配置:

hibernate.connection.provider_class = "org.hibernate.connection.C3P0ConnectionProvider";
hibernate.c3p0.min_size = 1;
hibernate.c3p0.max_size = 5;
hibernate.c3p0.timeout = 60;
hibernate.c3p0.acquire_increment = 2;
hibernate.c3p0.acquireRetryDelay = 20;
hibernate.c3p0.acquireRetryAttempts = 2;
hibernate.c3p0.idle_test_period = 10;
hibernate.c3p0.max_statements = 0;
hibernate.c3p0.maxIdleTimeExcessConnections = 60;
hibernate.c3p0.preferredTestQuery = "SELECT 1 FROM DUAL";

我读了“testConnectionOnCheckout'是确保连接可用性的最佳方法,但考虑到它会降低应用程序速度的代价,不希望使用它。

因此添加了idle_test_period。但即使这样,连接也会在空闲8小时后关闭(mysql的标准时间,连接自动关闭)。我错过了配置中的任何内容吗?

0 个答案:

没有答案
相关问题