2017-02-12 109 views
0

我正在使用c3p0来连接我的Java应用程序。我们编写与它有关的所有属性,并且我有wait_timeout值是60.我们不能增加wait_timeout值。我得到错误“连接无效”。如何处理这个错误。连接池中的连接无效

+1

的是, '联营'。 '轮询'是完全不同的, – EJP

+0

你应该在你的问题上加上澄清。你使用的确切属性是什么?你遇到的确切错误是什么? – JChrist

回答

0

您应该为等待超时设置max_idle_time;例如:

<property name="hibernate.c3p0.min_size">5</property> 
<property name="hibernate.c3p0.max_size">50</property> 
<property name="hibernate.c3p0.timeout">15</property> 
<property name="hibernate.c3p0.max_idle_time">60</property> 
<property name="hibernate.c3p0.max_statements">50</property> 
<property name="hibernate.c3p0.idle_test_period">10</property> 

看到此链接:http://www.mchange.com/projects/c3p0/index.html#configuration_files

你可以找到在堆栈溢出同样的问题来回例如:

Hibernate c3p0 connection pool not timing out idle connections

c3p0 maxIdleTime is same as wait_timeout of mysql?

+0

wait_time是28800时使用什么配置? –