TeslaCN opened a new issue #16124:
URL: https://github.com/apache/shardingsphere/issues/16124


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master - b31a5439e0c608ee9a735aadb426ed03b1e98a42
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy MySQL
   
   ### Expected behavior
   
   Batched update succeed.
   
   ### Actual behavior
   
   ```
   Exception in thread "main" java.sql.SQLException: Unsupported command: 
[COM_SET_OPTION]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
        at com.mysql.jdbc.MysqlIO.disableMultiQueries(MysqlIO.java:3670)
        at 
com.mysql.jdbc.PreparedStatement.executePreparedBatchAsMultiStatement(PreparedStatement.java:1492)
        at 
com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1303)
        at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970)
        at icu.wwj.MySQLBatchedUpdate.main(MySQLBatchedUpdate.java:18)
   ```
   
   ### Reason analyze (If you can)
   
   MySQL JDBC driver enable `rewriteBatchedStatements=true`.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   ```java
   try (Connection connection = 
DriverManager.getConnection("jdbc:mysql://127.0.0.1:13306/sbtest?useSSL=false&rewriteBatchedStatements=true",
 "root", "root")) {
       connection.setAutoCommit(false);
       try (PreparedStatement preparedStatement = 
connection.prepareStatement("update sbtest2 set k=k+1 where id = ?")) {
           for (int i = 0; i < 10; i++) {
               preparedStatement.setInt(1, i + 1);
               preparedStatement.addBatch();
           }
           preparedStatement.executeBatch();
       }
       connection.rollback();
   }
   
   ```
   


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