RaigorJiang commented on issue #9786:
URL: https://github.com/apache/shardingsphere/issues/9786#issuecomment-810754807
Hi, @GLBB
I have reproduced the Exception that you
mentioned(ArrayIndexOutOfBoundsException).
And I found the reason was in the connection url.
I prepared a sharding env for testing:
- ds_0.t_order
- ds_1.t_order
**Create DLL is:**
`CREATE TABLE `t_order` (
`order_id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`status` varchar(45) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci;
`
All the records are
- 1,1,'ok'
- 2,2,'ok'
- 3,3,'ok'
**case 1: set 'useServerPrepStmts' to false (default is false)**
`Logic SQL: SELECT * FROM t_order;
Actual SQL: ds_0 ::: SELECT * FROM t_order ORDER BY order_id ASC ;
Actual SQL: ds_1 ::: SELECT * FROM t_order ORDER BY order_id ASC ;`
the database packet codec(from PacketCodec.class) was like:
- |.....1.1.ok |
- |.....2.2.ok |
- |.....3.3.ok |
- and the test result was as expected.
**case 2: set 'useServerPrepStmts' to true**
`Logic SQL: SELECT * FROM t_order;
Actual SQL: ds_0 ::: SELECT * FROM t_order ORDER BY order_id ASC ;
Actual SQL: ds_1 ::: SELECT * FROM t_order ORDER BY order_id ASC ;`
the database packet codec(from PacketCodec) was like:
- |...............o|
|k |
- |...............o|
|k |
- |...............o|
|k |
- so we got the Exception.
Now, you may think about whether the parameter 'useServerPrepStmts' is
useful to your project.
For more details, we need to be studied.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]