首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

hibernate+mysql too many connections错误

2013-12-23 
hibernate+mysql too many connections异常Data source rejected establishment of connection,message fr

hibernate+mysql too many connections异常
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

?解决方法:

在执行完查询操作后,仅仅调用了session.close();来关闭session,而没有

调用factory.close();来关闭SessionFanctory。

二者都关闭后不再出现上述异常。

热点排行