Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

保持数据库Connection可用问题 #931

Open
ivywjhua opened this issue Aug 7, 2015 · 2 comments
Open

保持数据库Connection可用问题 #931

ivywjhua opened this issue Aug 7, 2015 · 2 comments

Comments

@ivywjhua
Copy link

ivywjhua commented Aug 7, 2015

问题

  • 设置validationQuery, testWhileIdle=true
  • 业务一段时间不操作数据库(比后台的定时任务)
  • 然后再进行数据库操作, Connection连接上报 mysql 的 wait_timeout错误。

从语意上来讲, testWhileIdle=true 配置后,Druid应该会隔一段时去使用一下 Connection, 保持Connection的连通性。 但是结果看到结果并不是这样。

另外看了一下源代码, Druid并没有定时去保持Connection的连通性,只是在 getConnectionDirect()的时候,顺便测试了一下。请问这么设计的初衷和原因是什么?

=====分割线
app部署在tomcat, 启动tomcat
启动后, 30分钟不去访问 app的url
30分钟之后去访问 app, Connection也报 上面的 mysql wait_timeout错误。

@wenshao
Copy link
Member

wenshao commented Aug 16, 2015

两者效果应该是一样的啊

@blackshadowwalker
Copy link

#939

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants