SQL Error: 0, SQLState: 08S01 Communications link failure

后端 未结 4 1045
野趣味
野趣味 2020-12-03 07:52

I am getting this error (not so frequently):

2013-05-08 16:44:35,786  WARN (JDBCExceptionReporter.java:100) [org.hibernate.util.JDBCExceptionReporter, logExc         


        
4条回答
  •  失恋的感觉
    2020-12-03 08:09

    I'm answering on specific to this error code(08s01).

    usually, MySql close socket connections are some interval of time that is wait_timeout defined on MySQL server-side which by default is 8hours. so if a connection will timeout after this time and the socket will throw an exception which SQLState is "08s01".

    1.use connection pool to execute Query, make sure the pool class has a function to make an inspection of the connection members before it goes time_out.

    2.give a value of greater than the default, but the largest value is 24 days

    3.use another parameter in your connection URL, but this method is not recommended, and maybe deprecated.

提交回复
热议问题