790477691 commented on issue #23543:
URL:
https://github.com/apache/shardingsphere/issues/23543#issuecomment-1382640146
```text
org.springframework.transaction.CannotCreateTransactionException: Could not
open JDBC Connection for transaction; nested exception is
java.lang.RuntimeException: Failed to get driver instance for
jdbcUrl=jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
at
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:305)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:378)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:474)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:289)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at
org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy93.queryPageDayTrajectory(Unknown Source)
at
com.uzhie.web.service.GpsService.trajectoryTexts_1(GpsService.java:1629)
at com.uzhie.web.service.GpsService.access$300(GpsService.java:58)
at com.uzhie.web.service.GpsService$4.call(GpsService.java:1542)
at com.uzhie.web.service.GpsService$4.call(GpsService.java:1508)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Failed to get driver instance for
jdbcUrl=jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
at
com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:114)
at
com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:321)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:110)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
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)
at
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.createDataSource(DriverDataSourceCache.java:51)
at
java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.get(DriverDataSourceCache.java:45)
at
org.apache.shardingsphere.driver.ShardingSphereDriver.connect(ShardingSphereDriver.java:51)
at
org.springframework.jdbc.datasource.SimpleDriverDataSource.getConnectionFromDriver(SimpleDriverDataSource.java:143)
at
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205)
at
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:169)
at
org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:169)
at
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:262)
... 20 more
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:315)
at
com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
... 42 more
```
```text
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>5.2.1</version>
</dependency>
```
```text
databaseName: oracleSource
dataSources:
oracleSource1:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@//111.111.11.13:9521/road
username: road
password: road
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
oracleSource2:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@//111.111.11.12:9521/road1
username: road1
password: road1
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
oracleSource3:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: oracle.jdbc.driver.OracleDriver
jdbcUrl: jdbc:oracle:thin:@//111.111.11.11:9521/road2
username: road2
password: road2
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
- !SHARDING
tables:
MJM_GPS_RECORD:
actualDataNodes: oracleSource${1..3}.MJM_GPS_RECORD
databaseStrategy:
standard:
shardingColumn: TELEPHONE
shardingAlgorithmName: hint_test
MJM_JS_ATTACHMENT:
actualDataNodes: oracleSource${1..3}.MJM_JS_ATTACHMENT
databaseStrategy:
standard:
shardingColumn: SIM_NUMBER
shardingAlgorithmName: hint_test
MJM_JS_BLIND_AREA:
actualDataNodes: oracleSource${1..3}.MJM_JS_BLIND_AREA
databaseStrategy:
standard:
shardingColumn: SIM_NUMBER
shardingAlgorithmName: hint_test
MJM_JS_DRIVER_STATUS:
actualDataNodes: oracleSource${1..3}.MJM_JS_DRIVER_STATUS
databaseStrategy:
standard:
shardingColumn: SIM_NUMBER
shardingAlgorithmName: hint_test
MJM_JS_DRIVING_ASS:
actualDataNodes: oracleSource${1..3}.MJM_JS_DRIVING_ASS
databaseStrategy:
standard:
shardingColumn: SIM_NUMBER
shardingAlgorithmName: hint_test
MJM_WARNING:
actualDataNodes: oracleSource${1..3}.MJM_WARNING
databaseStrategy:
standard:
shardingColumn: SIM_NUMBER
shardingAlgorithmName: hint_test
bindingTables:
-
MJM_GPS_RECORD,MJM_JS_ATTACHMENT,MJM_JS_BLIND_AREA,MJM_JS_DRIVER_STATUS,MJM_JS_DRIVING_ASS,MJM_WARNING
broadcastTables:
-
MJM_REPORT_LAST_POSITION,MJM_8702,T_SERVER_DB,T_GPS_RECORD_LOG_JOB,MJM_PICTURE_MATCH
# defaultDatabaseStrategy:
# hint:
# shardingColumn:
# shardingAlgorithmName: hint_test
# defaultTableStrategy:
# none:
shardingAlgorithms:
hint_test:
type: HINT_TEST
props:
max-connections-size-per-query: 1
kernel-executor-size: 16 # Infinite by default.
proxy-frontend-flush-threshold: 128 # The default value is 128.
proxy-hint-enabled: true
sql-show: true
check-table-metadata-enabled: false
```
```text
<bean id="dataSource" class="com.uzhie.dataSoruce.DynamicDataSource">
<property name="targetDataSources">
<map>
<entry key="mysqlSource" value-ref="mysqlSource"/>
<entry key="mysqlSourceBj" value-ref="mysqlSourceBj"/>
<entry key="oracleSource" value-ref="oracleSource"/>
<!-- <entry key="oracleSource"
value-ref="shardingDataSource"/>-->
<!-- <entry key="h2Source" value-ref="h2Source" />-->
</map>
</property>
<property name="defaultTargetDataSource" ref="mysqlSource"/>
</bean>
<bean id="oracleSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass"
value="org.apache.shardingsphere.driver.ShardingSphereDriver"/>
<property name="url"
value="jdbc:shardingsphere:classpath:scratch.yml" />
</bean>
```
An error occurred using this configuration
--
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]