`
m635674608
  • 浏览: 5004651 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

mysql Communications link failure

    博客分类:
  • java
 
阅读更多
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback().看到这个错误后先查看代码,首先想到
<iframe id="cproIframe_u2330612_3" style="margin: 0px; padding: 0px;" src="http://pos.baidu.com/acom?adn=3&amp;adp=1&amp;at=0&amp;aurl=&amp;c01=1&amp;cad=1&amp;ccd=24&amp;cec=GBK&amp;cfv=0&amp;ch=0&amp;col=zh-CN&amp;conBW=1&amp;conOP=1&amp;cpa=1&amp;cpro_lu=1%2C%23dfe4f9%2C%23000000%2C%E5%AE%8B%E4%BD%93&amp;dai=3&amp;dis=0&amp;layout_filter=image&amp;ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DkE-PAM6G9mNftETqRRx83baKiUWxI6RdwUYY3Zn6HPSxlVHC___jx3H9nStzXCiVqfHY4Jfwl0Hm6wloul9KE591fEp8IBZNr3n4fFogSam%26wd%3D%26eqid%3D9d83345600047ae900000002566ba9c7&amp;ltu=http%3A%2F%2Fwww.68idc.cn%2Fhelp%2Fbuildlang%2Fask%2F20150616370237.html&amp;lu_161=0&amp;lunum=6&amp;n=24066120_cpr&amp;pat=17&amp;pcs=1754x736&amp;pis=10000x10000&amp;ps=549x394&amp;psr=1920x1080&amp;pss=1754x575&amp;ptt=0&amp;qn=4d3e8821fb27d2a5&amp;rad=&amp;rsi0=300&amp;rsi1=300&amp;rsi5=4&amp;rss0=%23FFFFFF&amp;rss1=%23FFFFFF&amp;rss2=%23000000&amp;rss3=%23444444&amp;rss4=%23008000&amp;rss5=&amp;rss6=%23e10900&amp;rss7=&amp;scale=&amp;skin=tabcloud_skin_5&amp;stid=5&amp;td_id=2330612&amp;titFF=%E5%AE%8B%E4%BD%93&amp;titFS=14&amp;titSU=0&amp;titTA=left&amp;tn=baiduCustNativeAD&amp;tpr=1449898471080&amp;ts=1&amp;version=2.0&amp;xuanting=0&amp;dtm=BAIDU_DUP2_SETJSONADSLOT&amp;dc=2&amp;di=u2330612&amp;ti=mysql%20Communications%20link%20failure%20(with%20http%20request)%20-%20%E9%B8%BF%E7%BD%91%E4%BA%92%E8%81%94&amp;tt=1449898471068.615.889.889" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" align="center,center" width="300" height="300"></iframe>
<iframe id="cproIframe_u2330621_4" style="margin: 0px; padding: 0px;" src="http://pos.baidu.com/acom?adn=0&amp;at=128&amp;aurl=&amp;cad=1&amp;ccd=24&amp;cec=GBK&amp;cfv=0&amp;ch=0&amp;col=zh-CN&amp;conBW=0&amp;conOP=1&amp;cpa=1&amp;cpro_lu=1%2C%23dfe4f9%2C%23000000%2C%E5%AE%8B%E4%BD%93&amp;dai=4&amp;dis=0&amp;ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DkE-PAM6G9mNftETqRRx83baKiUWxI6RdwUYY3Zn6HPSxlVHC___jx3H9nStzXCiVqfHY4Jfwl0Hm6wloul9KE591fEp8IBZNr3n4fFogSam%26wd%3D%26eqid%3D9d83345600047ae900000002566ba9c7&amp;ltu=http%3A%2F%2Fwww.68idc.cn%2Fhelp%2Fbuildlang%2Fask%2F20150616370237.html&amp;lu_161=0&amp;lunum=6&amp;n=24066120_cpr&amp;pcs=1754x736&amp;pis=10000x10000&amp;ps=549x1034&amp;psr=1920x1080&amp;pss=1754x875&amp;qn=dd115ff2fd3f605d&amp;rad=&amp;rsi0=300&amp;rsi1=300&amp;rsi5=4&amp;rss0=%2386AC5F&amp;rss1=%23FFFFFF&amp;rss2=%230000ff&amp;rss3=&amp;rss4=&amp;rss5=&amp;rss6=%23e10900&amp;rss7=&amp;scale=&amp;skin=tabcloud_skin_5&amp;stid=5&amp;td_id=2330621&amp;titFF=%E5%AE%8B%E4%BD%93&amp;titFS=12&amp;titTA=left&amp;tn=baiduCustSTagLinkUnit&amp;tpr=1449898471080&amp;ts=1&amp;version=2.0&amp;xuanting=0&amp;dtm=BAIDU_DUP2_SETJSONADSLOT&amp;dc=2&amp;di=u2330621&amp;ti=mysql%20Communications%20link%20failure%20(with%20http%20request)%20-%20%E9%B8%BF%E7%BD%91%E4%BA%92%E8%81%94&amp;tt=1449898471068.897.1057.1057" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" align="center,center" width="300" height="300"></iframe>

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback().看到这个错误后先查看代码,首先想到,我先打开的数据库连接,并且执行了query和insert操作都没问题啊,但是最后的回滚就出问题了,下面根据日志分析一下:

mysql Communications link failure (with http request)

 

 

mysql Communications link failure (with http request)

 

 

 

mysql Communications link failure (with http request)

 

解决方案:
1. 修改Http请求时间,,连接请求超时+读取超时<60ms
2. 不要将HTTP请求放到数据库的事务操作中:
1) 在HTTP请求前执行完数据库操作,再执行HTTP请求,在更新之前操作的状态(成功、失败、未知)
2) 数据库的记录允许一定的丢数据,先执行HTTP请求,然后将执行结果在写入数据库

 

http://www.68idc.cn/help/buildlang/ask/20150616370237.html

分享到:
评论

相关推荐

    mysql-connector-java-8.0.23.zip druid-1.2.8.jar 资源包

    java 连接数据库资源包 mysql-connector-java-8.0.23.zip druid-1.2.8.jar

    Kettle所有数据库数据库连接驱动Jar

    其对应的Java驱动是`mysql-connector-java.jar`,用于在Java程序中建立与MySQL服务器的连接。 3. **Access**:虽然Access主要是一款桌面数据库,但通过Jet引擎,也可以使用ODBC或JDBC进行连接。在Java环境中,通常...

    pycharm工具连接mysql数据库失败问题

    在使用PyCharm这款强大的Python开发工具时,有时可能会遇到无法成功连接MySQL数据库的问题。这个问题主要是由于MySQL服务器返回的时区信息与PyCharm期望的不一致所导致的。MySQL默认使用UTC(协调世界时间)时区,而...

    阿里云ECS云服务器(linux系统)安装mysql后远程连接不了(踩坑)

    主要介绍了阿里云ECS云服务器(linux系统)安装mysql后远程连接不了(踩坑),小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    Durid连接Mycat+MySQL过程中报1243错误的解决办法

    开始受到“Communications link failure”和“连接超时”等信息的误导,一直将问题定位在“MySQL 连接超时时间”Timeout 参数上,该参数默认为 8 小时,并且一直认为问题就出在 “MySQL”上,甚至于要大动干戈的将 ...

    关于MySQL的wait-timeout连接超时问题报错解决方案.docx

    ERROR [org.hibernate.util.JDBCExceptionReporter] - Communications link failure Last packet sent to the server was 0 ms ago. 这种错误信息表明,MySQL 连接已经超时,无法与服务器进行通信。如果不是第一次...

    mysql 异常com.mysql.jdbc.CommunicationsException

    本次异常的具体描述为:“Communications link failure due to underlying exception: **BEGINNESTED EXCEPTION** java.io.EOFException STACK TRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully...

    浅析mysql交互式连接&非交互式连接

    如果应用程序未检测到这一情况,继续使用已被关闭的连接,将会导致通信链接失败异常,如"Communications link failure"。因此,为了防止此类异常,开发人员应在使用数据库连接时进行有效性检查,并及时关闭不再使用...

    MySQL wait_timeout连接超时

    这种现象在应用中可能导致突然的数据通信中断,表现为“Communications link failure”等错误,提示“Last packet sent to the server was 0 ms ago.”。为了解决这个问题,我们需要深入理解`wait_timeout`参数以及...

Global site tag (gtag.js) - Google Analytics