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.