Mysql
 sql >> Database >  >> RDS >> Mysql

Come si esegue un inserto esteso utilizzando JDBC senza creare stringhe?

prospetti preparati + inserto batch:

PreparedStatement stmt = con.prepareStatement(
"INSERT INTO employees VALUES (?, ?)");

stmt.setInt(1, 101);
stmt.setString(2, "Paolo Rossi");
stmt.addBatch();

stmt.setInt(1, 102);
stmt.setString(2, "Franco Bianchi");
stmt.addBatch();

// as many as you want   
stmt.executeBatch();