apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
19.92k stars 6.73k forks source link

H2 database url check exp error #33480

Open lwr-max opened 6 days ago

lwr-max commented 6 days ago

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

tag-5.3.2

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

Can run in win10 ,when h2 mode is file

Actual behavior

When h2 use file mode,can not connect database,because url check is error

Reason analyze (If you can)

shardingsphere\infra\common\src\main\java\org\apache\shardingsphere\infra\database\metadata\dialect\H2DataSourceMetaData.java private static final Pattern PATTERN = Pattern.compile("jdbc:h2:((?mem|~):/|"

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Only use in file mode,and url like jdbc:h2:file:D:/h2/data;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE,it will be reproduced

Example codes for reproduce this issue (such as a github link).

You can use this config dataSources: ds0: dataSourceClassName: com.zaxxer.hikari.HikariDataSource driverClassName: org.h2.Driver jdbcUrl: jdbc:h2:file:D:/05/h2/data;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MySQL username: admin password: admin rules:

terrymanu commented 6 days ago

Is the same issue present in the latest version as well?