xuschang opened a new issue, #27921:
URL: https://github.com/apache/shardingsphere/issues/27921
## Bug Report
driverClassName: org.mariadb.jdbc.Driver does not take effect.
### Which version of ShardingSphere did you use?
ShardingSphere-jdbc 5.4.0
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-jdbc 5.4.0
### Expected behavior
Can load the correct driverClass configuration
### Actual behavior
loaded the com.mysql.jdbc.Driver driver, but it is excluded in my project.
### Reason analyze (If you can)
The ``SKIPPED_PROPERTY_KEYS`` in the ``DataSourceReflection`` class includes
"``driverClassName``", so the property cannot be injected. If the driverClass
in the data source is empty, the default driver will be loaded via the URL. For
jdbc:mysql:/xxxx:3306/db?xxx, the corresponding driver is
com.mysql.jdbc.driver, but this is not the one I configured, which is
org.mariadb.jdbc.Driver. If I remove the "driverClassName" exclusion, the
program works normally.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
config.yaml
```
dataSources:
db-0:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.mariadb.jdbc.Driver
url:
jdbc:mysql://xxxx:3306/uihpacsdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: 123456
```
pom.xml
```
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>
```
Ensure that the project does not have the JDBC driver com.mysql.jdbc.Driver.
the result is:
```
2023-08-04 18:59:06.575 ERROR [http-nio-8080-exec-1]
com.alibaba.druid.pool.DruidDataSource : {dataSource-1} init error
java.sql.SQLException: com.mysql.jdbc.Driver
at com.alibaba.druid.util.JdbcUtils.createDriver(JdbcUtils.java:676)
at
com.alibaba.druid.pool.DruidDataSource.resolveDriver(DruidDataSource.java:1203)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:878)
```
--
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]