Mysql wait_timeout Solution

Source: Internet
Author: User


Mysql wait_timeout solves the problem: www.2cto.com ssh + mysql project, the data source is dbcp, the following error occurs during access overnight: 1 cocould not open Hibernate Session for transaction; nested exception is org. hibernate. transactionException: JDBC begin failed: 2... cause: mysql has a property "wait_timeout". The default value is 28800 seconds (8 hours). You can use the following password to view 1 mysql> show global variables like 'wait _ timeout '; it means that a connection of mysql is idle for more than 8 hours, and mysql will automatically disconnect the connection. Because dbcp does not check whether the connection is valid, an exception occurs when you use it for data operations. Solution: www.2cto.com modify the dbcp configuration: 1 timeBetweenEvictionRunsMillis = 20000 2 minEvictableIdleTimeMillis = 28700 "timeBetweenEvictionRunsMillis" dbcp checks the connection every 2000 seconds, "minEvictableIdleTimeMillis" disconnects idle connection for more than 28700 seconds in each test.

Related Article

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.