apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.66k stars 6.67k forks source link

Some questions about using ShardingSphere-Proxy to proxy sqlserver #32046

Open wingsofdragon opened 2 weeks ago

wingsofdragon commented 2 weeks ago

In the configuration of dataSources, SQLServer connection requires "url" to be in strict format: jdbc:(microsoft:)?sqlserver://([\w-.]+):?(\d);\S(DatabaseName|database)=([\w-.]+);?, otherwise it cannot be recognized. However, the "url" that meets the requirements will throw a NumberFormatException in (StandardJdbcUrlParser.java:76). After changing AUTHORITY_PATTERN = "(?://(?[^/?#]))?\s" to AUTHORITY_PATTERN = "(?://(?[^/?#;]))?\s", it can be started normally. However, ShardingSphere-Proxy cannot be used normally, and an error is reported after connection: create connection SQLException, url: jdbc:sqlserver://127.0.0.1:3307;databasename=sharding_db, errorCode 0, state 08S01. Error: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later."

wingsofdragon commented 2 weeks ago

Driver version used:

com.microsoft.sqlserver mssql-jdbc 6.1.7.jre8-preview
terrymanu commented 2 weeks ago

What is your SQL Server connection URL?

wingsofdragon commented 2 weeks ago

What is your SQL Server connection URL? In ShardingSphere-Proxy: url: jdbc:sqlserver://127.0.0.1:1433;databasename=mydatabase In my project: url: jdbc:sqlserver://127.0.0.1:3307;databasename=sharding_db

Note: When I switch the data source to mysql, it works fine.

terrymanu commented 2 weeks ago

What's mean URL in ShardingSphere-Proxy or URL in your project?

wingsofdragon commented 2 weeks ago

What's mean URL in ShardingSphere-Proxy or URL in your project?

I misunderstood, let's put this aside, the URL for ShardingSphere-Proxy is: jdbc:sqlserver://127.0.0.1:1433;databasename=mydatabase

terrymanu commented 2 weeks ago

Can you provide an example to reproduce it?

wingsofdragon commented 6 days ago

https://shardingsphere.apache.org/document/current/en/overview/ The official website states that SQLserver is not currently supported by ShardingSphere-Proxy. @terrymanu I appreciate your patient answer.