MySQL connection problem: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException

Source: Internet
Author: User

Com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:Data Source rejected establishment of Connection, message from server: "Too many connections"

Cause: Because the number of concurrent connections set in the My.ini in your MySQL installation directory is too low or the system is busy, the number of connections is fully occupied


How to resolve:

Open MySQL install directory open My.ini find Max_connections (in about line 93rd) default is 1001 like set to 500~1000 more appropriate, restart MySQL, so 1040 error is solved.

max_connections=1000

Specific steps:

The default number of connections for a 1.Mysql database is 100.

2. The default value of 100 is not sufficient for the general program, if you just debug the program on your own computer, you may not find this problem, because the debugger will often restart Tomcat.

3. This is especially true if the hibernate framework is used for database operations.

4. Workaround: Increase the number of MySQL connections. In the MySQL installation file, locate the My.ini file and find it in the

max-connections=100, make this 100 bigger, straight to a 1000.

PS: The specific need to modify the value according to the actual situation of the project depends on ...

MySQL connection problem: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException

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.