系统是Win7,在本地Mysql数据库里测试没问题。但是,如果连接上远程Linux上的Mysql数据库,过一段时间就会出现问题,在插入一条记录时,提示下列信息。
HTTP Status 500 -type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionorg.hibernate.exception.JDBCConnectionException: could not load an entity: [entity.User#1]
       ……root causecom.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet successfully received from the server was 280,216 milliseconds ago.  The last packet sent successfully to the server was 1 milliseconds ago.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        ……希望大家指点迷津……

解决方案 »

  1.   

     你是不是用到了连接池呢?
      这个问题应该是连接失效了.mysql数据库的连接是有时长的,超过设置的时长,mysql服务器自动会把连接回收.这个时长需要在mysql的my.ini文件里面设置.
      

  2.   

     这个问题应该是连接失效了.mysql数据库的连接是有时长的,超过设置的时长,这个时长需要在mysql的my.ini文件里面设置.自己看看