C3P0 Error apparent deadlock!!! Resolve _ Database

Source: Internet
Author: User

Reproduced from: http://japi.iteye.com/blog/254786


Thank the original author
There have been a lot of errors in the use of c3p0. The longest sight is a deadlock, which occupies a relatively large resource.

For deadlock problems http://japi.iteye.com/blog/243702. Found the solution (not fully guaranteed, but in the load test, there are no problems)

The key to the problem is the setting of the parameter
Reference
<!--JDBC Standard parameters to control the number of preparedstatements loaded in the data source. But because of the statements of the cache
belong to a single connection rather than the entire connection pool. So setting this parameter takes into account many factors.
If both maxstatements and maxstatementsperconnection are 0, the cache is closed. Default:0-->
<property name= "Maxstatements" >100</property>

<!--maxstatementsperconnection defines the maximum number of cached statements that a single connection has within a connection pool. default:0-->
<property name= "Maxstatementsperconnection" ></property>


The solution is:
Reference in Hibernate.cfg.xml:
<property name= "Hibernate.c3p0.max_statements" >0</property>


In C3p0.properties:
C3p0.maxstatements=0
c3p0.maxstatementsperconnection=100

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.