FlyingZC commented on code in PR #25172:
URL: https://github.com/apache/shardingsphere/pull/25172#discussion_r1169396391


##########
kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/factory/ExternalMetaDataFactory.java:
##########
@@ -76,12 +85,26 @@ private static Map<String, ShardingSphereDatabase> 
createGenericDatabases(final
             String databaseName = entry.getKey();
             if (!entry.getValue().getDataSources().isEmpty() || 
!protocolType.getSystemSchemas().contains(databaseName)) {
                 Map<String, DatabaseType> storageTypes = 
DatabaseTypeEngine.getStorageTypes(entry.getKey(), entry.getValue());
+                checkSupportedStorageTypes(entry.getValue().getDataSources(), 
databaseName, storageTypes);
                 result.put(databaseName.toLowerCase(), 
ShardingSphereDatabase.create(databaseName, protocolType, storageTypes, 
entry.getValue(), props, instanceContext));
             }
         }
         return result;
     }
     
+    private static void checkSupportedStorageTypes(final Map<String, 
DataSource> dataSources, final String databaseName, final Map<String, 
DatabaseType> storageTypes) throws SQLException {
+        if (dataSources.isEmpty()) {
+            return;
+        }
+        try (Connection connection = 
dataSources.values().iterator().next().getConnection()) {
+            String url = connection.getMetaData().getURL();
+            if (MOCKED_URL.stream().anyMatch(url::startsWith)) {
+                return;
+            }
+        }
+        storageTypes.forEach((key, value) -> 
ShardingSpherePreconditions.checkState(!SQL92DatabaseType.class.equals(value.getClass()),
 () -> new UnsupportedStorageTypeException(databaseName, key)));

Review Comment:
   <img width="325" alt="image" 
src="https://user-images.githubusercontent.com/19788130/232644282-0e45dcbe-025d-45f2-85ec-15ca2060355b.png";>
   All the database types we support are here. When the corresponding database 
type cannot be matched through the url, the default `SQL92DatabaseType` will be 
returned.



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