bw-chuxin opened a new issue, #45940:
URL: https://github.com/apache/doris/issues/45940

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   2.1.2
   
   ### What's Wrong?
   
   
jdbc批量写入开启useServerPrepStmts=true和rewriteBatchedStatements=true后如果批量写入的参数总数超过65535,jdbc驱动会报如下错误
   ```
   java.lang.ArrayIndexOutOfBoundsException: 2464
        at 
com.mysql.cj.NativeQueryBindings.getBinding(NativeQueryBindings.java:191)
        at 
com.mysql.cj.NativeQueryBindings.setFromBindValue(NativeQueryBindings.java:198)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.setOneBatchedParameterSet(ClientPreparedStatement.java:591)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchWithMultiValuesClause(ClientPreparedStatement.java:675)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:409)
        at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:795)
        at com.dlink.App.main(App.java:44)
   ```
   实际原因是 
doris服务端在处理COM_STMT_PREPARE命令时会从sql中解析出参数的个数,在应答的时候会将参数个数返回去,由于应答中报文中参数个数的的长度时2个字节,当参数个数超过65535时,数据会溢出,导致jdbc驱动接收到的长度不是真实的长度,所以jdbc构造出的NativeQueryBindings长度不合法导致操作报错。
   
   ### What You Expected?
   
   应该给出一个更加合理的提示,目前这个报错不太友好,会误导使用者。
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to