Database Connection to MySQL times out even after setting c3p0.testConnectionOnCheckout=true

后端 未结 2 427
孤城傲影
孤城傲影 2021-01-19 02:08

I have an app that uses hibernate (v3.6.4) , with connection pooling provided by C3P0 (v0.9.1.2) .

The problem is I get a JDBC communications link failure if I make

2条回答
  •  旧巷少年郎
    2021-01-19 02:57

    We started having the same "Communications Link" issue when we upgraded hibernate to 4.3.x using JPA and C3P0 for connection pooling.

    It seems like this would be a connection pool issue since connections were being kept longer than the database wait_timeout (which was the default 8 hours) despite my C3P0 settings. However, I fixed the issue by changing the hibernate configuration in our persistence.xml with:

    
    

    It seems the default behavior in hibernate changed to not release the connection after transactions, so you have to explicitly set this mode if you're using pooling.

提交回复
热议问题