Skip to content

How to configure data source configuration #37103

@WXingSong

Description

@WXingSong

I use sharding-jdbc 5.5.1.
I have configured the following data source configurations in YAML

dataSources:
  ds0:
    dataSourceClassName: com.mysql.cj.jdbc.Driver
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/demo?serverTimezone=UTC&useSSL=false
    username: root
    password: 123456
    initialSize: 5
    maxActive: 20
    minIdle: 5
    maxWait: 60000
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1
 ds1:
    dataSourceClassName: com.mysql.cj.jdbc.Driver
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3307/demo?serverTimezone=UTC&useSSL=false
    username: root
    password: 123456
    initialSize: 5
    maxActive: 20
    minIdle: 5
    maxWait: 60000
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1

the log output:testWhileIdle is true, validationQuery not set.
This means that the configuration is unavailable.

my druid version is 1.2.27

<dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid-spring-boot-starter</artifactId>
                <version>1.2.27</version>
 </dependency>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions