hibernate连接mysql密码错误,hibernate+mysql too many connections错误
问题分析:
使用Hibernate连接MySQL,多次执行查询操作后会出现以下异常(执行查询的次数等于MySQL的max-connection参数的值):
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
欢迎大家阅读《hibernate+mysql too many connections错误》,跪求各位点评,by 搞代码
解决方法:
在执行完查询操作后,仅仅调用了session.close();来关闭session,而没有
调用factory.close();来关闭SessionFanctory。
二者都关闭后不再出现上述异常。
与50位技术专家面对面20年技术见证,附赠技术全景图总结
以上是生活随笔为你收集整理的hibernate连接mysql密码错误,hibernate+mysql too many connections错误的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: php ajax操作数据库,php +
- 下一篇: php表单数据提交到本业,PHP_PHP