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 +
- 下一篇: java api集合,javaAPI_集