No importjava. SQL. Connection; importjava. SQL. PreparedStatement;... Stringsqlinsertintoemployee (name, city, phone) values (?,?,?); ConnectionconnectionnewgetConnection (); PreparedStatementp
PreparedStatement key code update in batches without import java. SQL. connection; import java. SQL. preparedStatement ;//... string SQL = "insert into employee (name, city, phone) values (?, ?, ?) "; Connection connection = new getConnection (); PreparedStatement p
PreparedStatement: update key code in batches <无>
import java.sql.Connection;import java.sql.PreparedStatement; //...String sql = "insert into employee (name, city, phone) values (?, ?, ?)";Connection connection = new getConnection();PreparedStatement ps = connection.prepareStatement(sql); for (Employee employee: employees) { ps.setString(1, employee.getName()); ps.setString(2, employee.getCity()); ps.setString(3, employee.getPhone()); ps.addBatch();}ps.executeBatch();ps.close();connection.close();