mysql - Adding c3p0 to spring hibernate project -


I had some problems with connection timeout. Problem: mysql timeline is working after shutting down in hibernation. It is fast to work properly, but it does not write more data to the database. I was prompted when searching logs: last connection 53000 seconds - connection problem. The timeout is mysql-default (28000). So I tried to increase mysql timeline, but it will not be used in the production system.

Looking for a better solution, I found out, maybe c3p0 could solve my problem with a test question.

This problem starts when I am using Hibernate in spring with spring. I added c3p0 as Datasource (bean):

   & Lt; Property name = "jdbcUrl" value = "$ {hibernate.conction.val}" /> & Lt; Property Name = "User" value = "$ {Hibernate Connection .Username}" /> & Lt; Property Name = "Password" value = "$ {Hibernate Connection. Password}" /> & Lt; Property name = "minPoolSize" value = "$ {hibernate.connection.minPoolSize}" /> & Lt; Property Name = "maxPoolSize" value = "$ {Hibernate Connection.maxpool Size}" /> & Lt; Property Name = "Max Idle Time" value = "$ {Hibernate Connection.mix Idle Time}" /> & Lt; Property Name = "Maximum Location" value = "$ {Hibernate Connection.mxstams}" /> & Lt; Property Name = "testConnectionOnCheckout" value = "$ {hibernate.connection.testCo}" /> & Lt; Property Name = "testConnectionOnCheckin" value = "$ {hibernate.connection.testCo}" /> & Lt; Property Name = "PrivateTeactivityView" value = "$ {Hibernate Connection.Test SQL}" /> & Lt; Property name = "useless connection connection" value = "$ {hibernate.connection.testPeriod}" /> & Lt; / Bean & gt;  

But later, the application can not be started anymore:

  Exceptions in the thread "main" org.springframework .beans. Factory Bean Cases Exception: Error making bean with name 'App ConfiFile': Invoicing of autowel dependency failed; Nested exception org.springframework.beans.factory.BeanCreationException: could not autowire the field 

Then maybe I did some wrongly configured how I started to analyze the problem Do you?

Or is there any other good solution? Like to start an original SQL from Hibernate to keep the connection alive? I would prefer a solution with c3p0

Thank you.


Comments