You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/09/23 15:15:12 UTC

(shardingsphere) branch master updated: Support dotted Oracle JDBC service names (#39932)

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

terrymanu 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 89b50093d50 Support dotted Oracle JDBC service names (#39932)
89b50093d50 is described below

commit 89b50093d5097c5f3d731cd420cf8a268099bbe7
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Wed Sep 23 23:15:03 2026 +0800

    Support dotted Oracle JDBC service names (#39932)
---
 .../oracle/jdbcurl/OracleConnectionPropertiesParser.java         | 4 ++--
 .../oracle/jdbcurl/OracleConnectionPropertiesParserTest.java     | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParser.java b/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParser.java
index b4dfb2a2a47..44131f8385c 100644
--- a/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParser.java
+++ b/database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParser.java
@@ -40,10 +40,10 @@ public final class OracleConnectionPropertiesParser implements ConnectionPropert
     
     private static final String QUERY_DELIMITER = "?";
     
-    private static final Pattern THIN_URL_PATTERN = Pattern.compile("jdbc:oracle:(thin|oci|kprb):@(//)?([\\w\\-\\.]+):?(\\d*)[:/]([\\w\\-]+)", Pattern.CASE_INSENSITIVE);
+    private static final Pattern THIN_URL_PATTERN = Pattern.compile("jdbc:oracle:(thin|oci|kprb):@(//)?([\\w\\-\\.]+):?(\\d*)[:/]([\\w\\-\\.]+)", Pattern.CASE_INSENSITIVE);
     
     private static final Pattern CONNECT_DESCRIPTOR_URL_PATTERN = Pattern.compile(
-            "jdbc:oracle:(thin|oci|kprb):@[(\\w\\s=)]+HOST\\s*=\\s*([\\w\\-\\.]+).*PORT\\s*=\\s*(\\d+).*SERVICE_NAME\\s*=\\s*(\\w+)\\)");
+            "jdbc:oracle:(thin|oci|kprb):@[(\\w\\s=)]+HOST\\s*=\\s*([\\w\\-\\.]+).*PORT\\s*=\\s*(\\d+).*SERVICE_NAME\\s*=\\s*([\\w\\.]+)\\)");
     
     @Override
     public ConnectionProperties parse(final String url, final String username, final String catalog) {
diff --git a/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParserTest.java b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParserTest.java
index a7308e152b6..204ba0d7612 100644
--- a/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParserTest.java
+++ b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/jdbcurl/OracleConnectionPropertiesParserTest.java
@@ -68,6 +68,13 @@ class OracleConnectionPropertiesParserTest {
         public Stream<? extends Arguments> provideArguments(final ParameterDeclarations parameters, final ExtensionContext context) {
             return Stream.of(
                     Arguments.of("port", "jdbc:oracle:thin:@//127.0.0.1:9999/foo_ds", "127.0.0.1", 9999, "foo_ds", "test", new Properties()),
+                    Arguments.of("dottedService", "jdbc:oracle:thin:@//127.0.0.1:9999/foo_ds.example.com", "127.0.0.1", 9999, "foo_ds.example.com", "test", new Properties()),
+                    Arguments.of("dottedPooledService", "jdbc:oracle:thin:@//127.0.0.1:9999/foo_ds.example.com:POOLED", "127.0.0.1", 9999, "foo_ds.example.com", "test",
+                            new Properties()),
+                    Arguments.of("pooledService", "jdbc:oracle:thin:@//127.0.0.1:9999/foo_ds:POOLED", "127.0.0.1", 9999, "foo_ds", "test", new Properties()),
+                    Arguments.of("sharedService", "jdbc:oracle:thin:@//127.0.0.1:9999/foo_ds:SHARED", "127.0.0.1", 9999, "foo_ds", "test", new Properties()),
+                    Arguments.of("dottedDedicatedService", "jdbc:oracle:thin:@//127.0.0.1:9999/foo_ds.example.com:DEDICATED", "127.0.0.1", 9999, "foo_ds.example.com",
+                            "test", new Properties()),
                     Arguments.of("domainPort", "jdbc:oracle:oci:@ax-xx.frex.cc:9999/foo_ds", "ax-xx.frex.cc", 9999, "foo_ds", "test", new Properties()),
                     Arguments.of("ipDefaultPort", "jdbc:oracle:oci:@127.0.0.1/foo_ds", "127.0.0.1", 1521, "foo_ds", "test", new Properties()),
                     Arguments.of("domainDefaultPort", "jdbc:oracle:oci:@axxx.frex.cc/foo_ds", "axxx.frex.cc", 1521, "foo_ds", "test", new Properties()),
@@ -77,6 +84,8 @@ class OracleConnectionPropertiesParserTest {
                             + "(HOST = 127.0.0.1)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = ON)(CONNECT_DATA =(SERVER = DEDICATED)"
                             + "(SERVICE_NAME = rac)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))", "127.0.0.1", 1521, "rac", "test",
                             new Properties()),
+                    Arguments.of("connectDescriptorDottedService", "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))"
+                            + "(CONNECT_DATA=(SERVICE_NAME=foo_ds.example.com)))", "127.0.0.1", 1521, "foo_ds.example.com", "test", new Properties()),
                     Arguments.of("connectDescriptorDomainUrl", "jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = axxx.frex.cc)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)"
                             + "(HOST = axxx.frex.cc)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = ON)(CONNECT_DATA =(SERVER = DEDICATED)"
                             + "(SERVICE_NAME = rac)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))", "axxx.frex.cc", 1521, "rac", "test",