xuup opened a new issue, #19849:
URL: https://github.com/apache/shardingsphere/issues/19849
## Bug Report
### Which version of ShardingSphere did you use?
master
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
when request contains more than one sql, should execute as batch execute.
### Actual behavior
In my test , when request has more sql, shardingsphere-proxy cannot execute,
exception as bellow:
code :
```
Class.forName("com.mysql.cj.jdbc.Driver");
String url =
"jdbc:mysql://127.0.0.1:3307/sharding_db?useSSL=false&allowMultiQueries=true";
String user = "****";
String pwd = "****";
Connection connection = DriverManager.getConnection(url, user, pwd);
PreparedStatement preparedStatement =
connection.prepareStatement("select count(1) from t_order;select * from t_order
where user_id=10");
ResultSet resultSet = preparedStatement.executeQuery();
```
exception log:
```
Exception in thread "main" java.sql.SQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'select * from t_order where
user_id=10 UNION ALL select count(1) from t_order_1;' at line 1
at
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
at
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
at
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
at
com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
at com.demo.jdbc.ShardingSphereJDBC.main(ShardingSphereJDBC.java:15)
```
but I communicate mysql rather than shardingsphere-proxy, the sql could be
executed ,
```
Class.forName("com.mysql.cj.jdbc.Driver");
String url =
"jdbc:mysql://127.0.0.1:3306/demo_ds_0?useSSL=false&allowMultiQueries=true";
String user = "***";
String pwd = "***";
Connection connection = DriverManager.getConnection(url, user, pwd);
PreparedStatement preparedStatement =
connection.prepareStatement("select 1 from dual;select count(1) from
t_order_0");
ResultSet resultSet = preparedStatement.executeQuery();
```
I think ShardingSphere should be support allowMultiQueries feature . FYI.
I am interested this issue , and I hope I will fix it if this issue be
confirmed.
--
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]