Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 即使在配置连接池后,休眠连接也会在8小时后关闭_Mysql_Hibernate_C3p0 - Fatal编程技术网

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

Mysql 即使在配置连接池后,休眠连接也会在8小时后关闭,mysql,hibernate,c3p0,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.acquireRetr

我的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";
我读到“TestConnectionOnOnCheckout”是确保连接可用性的最佳方法,但考虑到它会降低应用程序的速度,我不想使用它


因此增加了空闲测试周期。但即使如此,当空闲8小时时,连接也会关闭(mysql的标准时间是连接自动关闭之后)。配置中是否遗漏了任何内容?

您的应用程序是否看到无效连接?否。没有无效连接。每次启动webapp时,连接都会成功建立。但当webapp运行超过8小时时,与DB的连接就会关闭。