Narcasserun commented on a change in pull request #7294:
URL: https://github.com/apache/dolphinscheduler/pull/7294#discussion_r765876401



##########
File path: 
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProvider.java
##########
@@ -80,4 +89,23 @@ public static HikariDataSource 
createOneSessionJdbcDataSource(BaseConnectionPara
         return dataSource;
     }
 
+    protected static void loaderJdbcDriver(ClassLoader classLoader, 
BaseConnectionParam properties, DbType dbType) {
+        String drv = StringUtils.isBlank(properties.getDriverClassName()) ? 
DatasourceUtil.getDatasourceProcessor(dbType).getDatasourceDriver() : 
properties.getDriverClassName();
+        try {
+            final Class<?> clazz = Class.forName(drv, true, classLoader);
+            final Driver driver = (Driver) clazz.newInstance();
+            if (!driver.acceptsURL(properties.getJdbcUrl())) {
+                logger.warn("Jdbc driver loading error. Driver {} cannot 
accept url.", drv);
+                throw new RuntimeException("Jdbc driver loading error.");
+            }
+            if (dbType.equals(DbType.MYSQL) && driver.getMajorVersion() >= 8) {
+                properties.setDriverClassName(drv);
+            } else {

Review comment:
       yes




-- 
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]


Reply via email to