Communications link failure due to: java.io.EOFException

前端 未结 1 1857
你的背包
你的背包 2020-12-10 20:50

My webapp is running on Tomcat 5.5, I declared the datasource in web.xml:


    jdbc/OrdiniWebDS
         


        
1条回答
  •  心在旅途
    2020-12-10 20:55

    MySQL drops unused connections after a while because it assumes that the other side forgot to close it.

    What you need to do is to configure a check that Tomcat should apply before it reuses a pooled connection. To do this, add ?autoReconnect=true&useUnicode=true&characterEncoding=utf8 to the end of the URL and add validationQuery="Select 1" to the Resource element:

    
    

    [EDIT] This page gives more details: Configuring a MySQL Datasource in Apache Tomcat

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