You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "WXingSong (via GitHub)" <gi...@apache.org> on 2025/11/14 14:16:12 UTC
[I] How to configure data source configuration [shardingsphere]
WXingSong opened a new issue, #37103:
URL: https://github.com/apache/shardingsphere/issues/37103
I use sharding-jdbc.
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>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to configure data source configuration [shardingsphere]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #37103:
URL: https://github.com/apache/shardingsphere/issues/37103#issuecomment-3573080708
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to configure data source configuration [shardingsphere]
Posted by "WXingSong (via GitHub)" <gi...@apache.org>.
WXingSong commented on issue #37103:
URL: https://github.com/apache/shardingsphere/issues/37103#issuecomment-3535203255
> ShardingSphere 不支持 Druid 的自定义属性。 您可以`shardingsphere-infra-data-source-pool-type`自行扩展该模块以实现对 Druid 的自定义支持。
>
> 此外,基于 ShardingSphere 开发的企业级产品 SphereEx DBPlusEngine 提供了对 HikariCP 之外的数据库连接池的适配和支持。
>
> 公司网站:https://www.sphere-ex.com/ 开源版与企业版对比:https://www.sphere-ex.cn/comparison/
>
> 如果您有兴趣,可以在公司网站上找到他们的联系方式并与他们沟通。
So does ShardingSphere support all the configuration properties of HikariCP ? For example, connectionTestQuery, connectionTimeout, and so on.Are they all configured like this below?
```
dataSources:
ds0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://127.0.0.1:3306/demo?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
username: root
password: 123456
maximumPoolSize: 20
minimumIdle: 5
idleTimeout: 60000
maxLifetime: 1800000
connectionTimeout: 30000
validationTimeout: 5000
leakDetectionThreshold: 2000
connectionTestQuery: SELECT 1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to configure data source configuration [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #37103: How to configure data source configuration
URL: https://github.com/apache/shardingsphere/issues/37103
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to configure data source configuration [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #37103:
URL: https://github.com/apache/shardingsphere/issues/37103#issuecomment-3533711478
ShardingSphere cannot support Druid's customized properties.
You can extend the `shardingsphere-infra-data-source-pool-type` module on your own to implement customized support for Druid.
Additionally, the enterprise-level product SphereEx DBPlusEngine, developed based on ShardingSphere, provides adaptation and support for database connection pools beyond HikariCP.
Company website: https://www.sphere-ex.com/
For a comparison between the open-source and enterprise editions: https://www.sphere-ex.cn/comparison/
If you are interested, you can find their contact information on the company website to communicate with them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to configure data source configuration [shardingsphere]
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on issue #37103:
URL: https://github.com/apache/shardingsphere/issues/37103#issuecomment-3533697730
- My view is that you should provide a Git repository that includes unit tests. From my perspective, the way you configured `validationQuery` is fine.
- Since the ShardingSphere master branch doesn't test Alibaba Druid at all, I documented similar testing scenarios in a Chinese article on an external website, namely https://www.yuque.com/linghengqian/meve2v/zoy35sivtf6nzp90 . Both the `filters` and `useGlobalDataSourceStat` attributes are correctly recognized by ShardingSphere.
```yaml
mode:
type: Standalone
repository:
type: JDBC
dataSources:
ds_0:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.h2.Driver
url: jdbc:h2:mem:demo_ds_0;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
username: sa
password:
useGlobalDataSourceStat: true
filters: wall,mergeStat
ds_1:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.h2.Driver
url: jdbc:h2:mem:demo_ds_1;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
username: sa
password:
useGlobalDataSourceStat: true
filters: wall,io.github.linghengqian.filter.testd.CustomStatFilter
ds_2:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.h2.Driver
url: jdbc:h2:mem:demo_ds_2;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
username: sa
password:
useGlobalDataSourceStat: true
filters: >-
wall,
io.github.linghengqian.filter.testd.CustomStatFilter
```
- Incidentally, https://github.com/alibaba/druid/pull/6128 has never been merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to configure data source configuration [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #37103:
URL: https://github.com/apache/shardingsphere/issues/37103#issuecomment-3536601386
Not support on ShardingSphere-Proxy, can support for ShardingSphere-JDBC
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org