Problem description
In JDBC used in executeBatch command to update the JDBC Batch, tips below error.
[9001, 2020030316515301000000402003453324233] unsupport packet=>030000001B0000, packet_name=mysql_set_server_option
Solution
AnalyticDB for MySQL instances support JDBC Batch updates to improve the efficiency of concurrent updates. We recommend that you use the following statement in the JDBC database:
try (Connection connection = DriverManager.getConnection("jdbc:mysql://[$IP]:[$Port]/[$Database]", "[$User_Name]", "[$Password")) {
Statement statement = connection.createStatement();
statement.addBatch("update student set student_name='a' where student_id = 10");
statement.addBatch("update student set student_name='a' where student_id = 11");
statement.addBatch("update student set student_name='a' where student_id = 12");
statement.addBatch("update student set student_name='a' where student_id = 13");
statement.executeBatch();
} catch (SQLException e) {
e.printStackTrace();
}
Note:
- [$IP] is the IP address of the database.
- [$Port] is the Port number of the database.
- [$Database] is the name of the Database.
- [$User_Name] is the username of the database.
- [$Password] is the Password used to log on to the database.
Application scope
- AnalyticDB for MySQL