import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class ExecuteBatchTask {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql:///fruitdb?rewriteBatchedStatements=true", "root", "123456");
String sql = "insert into t_person values (0,?)";
PreparedStatement psmt = conn.prepareStatement(sql);
for (int i = 1; i <= 1000; i++) {
psmt.setString(1, "用户" + i);