You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/01/10 04:25:00 UTC

[shardingsphere] branch master updated: Use DataSourceMetaData URL parser to instead of StandardJdbcUrlParser (#14649)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 57c68b0  Use DataSourceMetaData URL parser to instead of StandardJdbcUrlParser (#14649)
57c68b0 is described below

commit 57c68b081f6cd480ab2fd705d58dd933b30bdf1f
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Jan 10 12:24:19 2022 +0800

    Use DataSourceMetaData URL parser to instead of StandardJdbcUrlParser (#14649)
---
 .../infra/config/datasource/pool/creator/DataSourceReflection.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourceReflection.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourceReflection.java
index a754d2a..5c82aaa 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourceReflection.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourceReflection.java
@@ -20,7 +20,8 @@ package org.apache.shardingsphere.infra.config.datasource.pool.creator;
 import com.google.common.base.CaseFormat;
 import com.google.common.collect.Sets;
 import lombok.SneakyThrows;
-import org.apache.shardingsphere.infra.database.metadata.url.StandardJdbcUrlParser;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
 
 import javax.sql.DataSource;
 import java.lang.reflect.Method;
@@ -161,7 +162,9 @@ public final class DataSourceReflection {
             return;
         }
         Properties targetDataSourceProps = getDataSourcePropertiesFieldName(dataSourcePropsFieldName);
-        Properties queryProps = new StandardJdbcUrlParser().parse(getJdbcUrl(jdbcUrlFieldName)).getQueryProperties();
+        String jdbcUrl = getJdbcUrl(jdbcUrlFieldName);
+        DatabaseType databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(jdbcUrl);
+        Properties queryProps = databaseType.getDataSourceMetaData(jdbcUrl, null).getQueryProperties();
         for (Entry<Object, Object> entry : defaultDataSourceProps.entrySet()) {
             String defaultPropertyKey = entry.getKey().toString();
             String defaultPropertyValue = entry.getValue().toString();