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

So what will cause ”testWhileIdle is true, validationQuery not set“ ? #1497

Open
sequarius opened this issue Nov 18, 2016 · 2 comments · May be fixed by #6128
Open

So what will cause ”testWhileIdle is true, validationQuery not set“ ? #1497

sequarius opened this issue Nov 18, 2016 · 2 comments · May be fixed by #6128

Comments

@sequarius
Copy link

I am using Spring Boot 1.4.2 and Druid 1.0.26 .I had put 'validationQuery' into my config ,How ever the error of “testWhileIdle is true, validationQuery not set” is throwed when I made SQL operation,Here is my config

spring:
  datasource:
    name: db#01
    url: 
    username: 
    password: 
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: net.sf.log4jdbc.DriverSpy
    filters: stat
    sessionStatEnable: true
    profileEnable: true
    maxActive: 20
    initialSize: 1
    maxWait: 60000
    minIdle: 1
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: select 1
    testWhileIdle: true
    maxOpenPreparedStatements: 20

so how can i resolve this problem

@sequarius sequarius changed the title So what will cause ”testWhileIdle is true, validationQuery not set“ So what will cause ”testWhileIdle is true, validationQuery not set“ ? Nov 18, 2016
@yuleizhuai
Copy link

validationQuery 用来检测连接是否有效的sql,要求是一个查询语句。
如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会其作用。
详见:https://github.com/alibaba/druid/wiki/DruidDataSource%E9%85%8D%E7%BD%AE%E5%B1%9E%E6%80%A7%E5%88%97%E8%A1%A8

En:If the validationQuery is null,testOnBorrow testOnReturn testWhileIdle its don't work!

@linghengqian
Copy link

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

Successfully merging a pull request may close this issue.

3 participants