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

后端 未结 4 1032
野趣味
野趣味 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 07:58

    The communication link between the driver and the data source to which the driver was attempting to connect failed before the function completed processing. So usually its a network error. This could be caused by packet drops or badly configured Firewall/Switch.

    0 讨论(0)
  • 2020-12-03 08:00

    Check your server config file /etc/mysql/my.cnf - verify bind_address is not set to 127.0.0.1. Set it to 0.0.0.0 or comment it out then restart server with:

    sudo service mysql restart
    
    0 讨论(0)
  • 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 <wait_timeout> 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.

    0 讨论(0)
  • 2020-12-03 08:20

    Could be due to the TCP protocol turned off.

    How to check/enable: https://dba.stackexchange.com/questions/11377/cannot-connect-to-ms-sql-2008-r2-by-dbvisualizer-native-sspi-library-not-loade/144097#144097

    0 讨论(0)
提交回复
热议问题