Hibernate + mysqltoomanyconnections exception analysis: when using Hibernate to connect to MySQL, the following exception occurs after multiple query operations (the number of queries executed equals the value of MySQL's max-connection parameter): Datasourcerejectedestablishmentofconnection, messagefromserver: Tooma
Exception Analysis of hibernate + mysql too connector connections: connect to MySQL using Hibernate. The following exception occurs after multiple query operations (the number of queries executed equals the value of the max-connection parameter of MySQL): Data source rejected establishment of connection, message from server: "Too ma
Exception in hibernate + mysql too connector connections
Problem Analysis:
Connect to MySQL using Hibernate. The following exception occurs after multiple query operations (the number of queries executed is equal to the value of the max-connection parameter of MySQL ):
Data source rejected establishment of connection, message from server: "Too many connections"org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) at org.hibernate.jdbc.ConnectionManager.openConnectionCaused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections" at com.mysql.jdbc.SQLError.createSQLException
? Solution:
After the query operation is completed, only session. close (); is called to close the session.
Call factory. close (); To disable SessionFanctory.
If both of them are disabled, the above exceptions will not occur.