zhhzhfya opened a new issue, #23333:
URL: https://github.com/apache/shardingsphere/issues/23333
## Bug Report
I got a exception, i don't know why? it call
org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository.init,
and try connect H2 get a connection, but exception.
**the exception:**
`
Caused by: java.sql.SQLTransientConnectionException: DataSource returned
null unexpectedly
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:360)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at
com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at
com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
at
org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository.init(JDBCRepository.java:67)
......
at
org.apache.shardingsphere.infra.util.spi.type.required.RequiredSPIRegistry.getRegisteredService(RequiredSPIRegistry.java:45)
at
org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepositoryFactory.getInstance(StandalonePersistRepositoryFactory.java:44)
at
org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:44)
at
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:76)
at
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:64)
at
org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:93)
at
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:133)
at
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:75)
`
**the java api :**
`
Properties properties = new Properties();
properties.setProperty("max.connections.size.per.query", "50");
DataSource dataSource =
YamlShardingSphereDataSourceFactory.createDataSource(shardingYaml.getBytes());
`
**the shardingYaml content is below:**
`
dataSources:
ds_1:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url:
jdbc:mysql://*************:3306/db?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username: ***
password: ***
ds_2:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url:
jdbc:mysql://*************:3306/db?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username: ***
password: ***
rules:
- !SHARDING
tables:
al_warninfo:
actualDataNodes:
ds_1.al_warninfo_20210$->{7..9},ds_1.al_warninfo_2021$->{10..12},ds_1.al_warninfo_$->{2022..2023}0$->{1..9},ds_1.al_warninfo_$->{2022..2023}$->{10..12}
tableStrategy:
standard:
shardingColumn: START_TIME
shardingAlgorithmName: yearMonth
eq_status_history:
actualDataNodes:
ds_1.eq_status_history_$->{2020..2023}0$->{1..9},ds_1.eq_status_history_$->{2020..2023}$->{10..12}
tableStrategy:
standard:
shardingColumn: BEGIN_TIME
shardingAlgorithmName: yearMonth
shardingAlgorithms:
yearMonth:
type: CLASS_BASED
props:
strategy: STANDARD
algorithmClassName:
com.bonc.core.base.db.sharding.YearMonthTableShardingAlgorithm
broadcastTables:
- eq_work_order
- eq_equip_thin
- eq_prod_auto_v
props:
sql-show: true
`
### Which version of ShardingSphere did you use?
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>5.3.0</version>
</dependency>
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
--
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:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]