当前位置:  开发笔记 > 编程语言 > 正文

成功发送到服务器的最后一个数据包是79,547毫秒.比服务器配置的'wait_timeout'值更长

如何解决《成功发送到服务器的最后一个数据包是79,547毫秒.比服务器配置的'wait_timeout'值更长》经验,为你挑选了0个好方法。

我有一个大问题,我不知道如何解决它:

我有一个数据库的单例实例如下:

public Connection getConnection() throws SQLException {
    if (db_con == null)
        db_con = createConnection();

    return db_con;
}

我有一个代码如下:

   shortTextScoringComponent.scoreComponent(    "RS",SelectDataBase.getBlogs(rightSarcastic));
    shortTextScoringComponent.scoreComponent( "RNS",SelectDataBase.getBlogs(rightNonSarcasm));
    shortTextScoringComponent.scoreComponent( "FNS",SelectDataBase.getBlogs(wrongNonSarcasm));
    shortTextScoringComponent.scoreComponent( "FS",SelectDataBase.getBlogs(wrongSarcasm));

因此,你可以看到我调用数据库4次,值得注意的是,每次调用之间都有很长的处理时间,因此在第二行成功执行之后,我的意思是这一行:

SelectDataBase.getBlogs(rightNonSarcasm);

当谈到第三行时,我收到以下错误:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet    successfully received from the server was 79,547,948 milliseconds ago.  The last packet sent successfully to the server was 79,547,964 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

   com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No     operations allowed after connection closed.

我搜索了很多,但有许多不同的答案让我困惑,你知道我的确切问题是什么吗?

推荐阅读
Life一切安好
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有