maximum connections reached ?

我使用 Tomcat + mysql

最近只要有使用到資料庫的程式,都會出現下面這個錯誤

我重開TOMCAT還是不行1義需要重新開機才會恢復正常

可是之後大約半天,問題又會恢復了。

請問這有可能是什麼原因呢? 同樣的程式之前跑了一年多都是好的,最近流量也沒有比較大啊!

會不會是電腦中毒了呢? 可是我的主機有灌卡巴斯基企業版 6.0 for windows server,應該不會是中毒吧?

謝謝!

Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException

MESSAGE: No buffer space available (maximum connections reached?): JVM_Bind

STACKTRACE:

java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind

at java.net.PlainSocketImpl.socketBind(Native Method)

at java.net.PlainSocketImpl.bind(Unknown Source)

at java.net.Socket.bind(Unknown Source)

at java.net.Socket. <init>(Unknown Source)

Update:

所有 connection 我都有 close

絕對不是這個問題

要不然為什麼之前半年都沒事,最近每天都 maximum connections reached ?

請問還有誰知道有其它的可能嗎?

2 Answers

Rating
  • 1 decade ago
    Favorite Answer

    connection一定要close啊, 不close就會把DB搞掛了

    Connection connection;

    connection.close(); <== 你應該是沒有關閉connection

    檢查看看哪個connection沒有關閉吧

    2009-08-05 13:08:26 補充:

    你要查查看mysql那裡的log, 不然很難判斷

    你可以試試

    1.增加mysql server的buffer size以及maximum connection

    2.爾或可能是memory相衝, 也可試試看把卡巴先關閉

    • Login to reply the answers
  • 1 decade ago

    在加一個finally{} 去關關看吧

    finally{

    statement.close();

    resultSet.close();

    connection.close();

    session.disconnect();

    }

    • Login to reply the answers
Still have questions? Get your answers by asking now.