数据库连接计时(Tomcat上的连接池)

时间:2011-08-17 15:46:26

标签: tomcat connection pooling

我的dB连接不断超时。我查看了人们为此提供的一些解决方案,并实施了它们,但到目前为止还没有任何结果。任何新想法都会非常有用。

问题
对于webapp的一些请求,这是我得到的错误:

  

com.mysql.jdbc.CommunicationsException:最后一个数据包成功   从服务器收到的是11,198,881毫秒之前。最后   成功发送到服务器的数据包是11,198,881毫秒   前。比服务器配置的'wait_timeout'值长。您   应考虑到期和/或测试连接有效性   在您的应用程序中使用之前,增加配置的服务器   客户端超时的值,或使用Connector / J连接   property'autoconnect = true'以避免此问题。

尝试解决方案

  1. 测试连接有效性
  2. 使用autoReconnect
  3. context.xml的内容

      

    资源名称=“jdbc / dBConnectionMain”auth =“容器”   type =“javax.sql.DataSource”maxActive =“20”maxIdle =“18”   removeAbandoned =“true”removeAbandonedTimeout =“60”logAbandoned =“true”   validationQuery =“select 1”testOnBorrow =“true”username =“user”   password =“password”driverClassName =“com.mysql.jdbc.Driver”   url =“jdbc:mysql:// localhost / databaseName?autoReconnect = true”/

    关于此的任何指示?

    干杯,
    RD

0 个答案:

没有答案