Here you can find the source of executeAsBatch(Connection con, List
public static int[] executeAsBatch(Connection con, List<String> sqlList) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.*; import java.util.*; public class Main { public static int[] executeAsBatch(Connection con, List<String> sqlList) throws SQLException { return executeAsBatch(con, sqlList.toArray(new String[] {})); }/*from w w w .j a va2 s .c om*/ public static int[] executeAsBatch(Connection con, String[] sqlArray) throws SQLException { Statement stmt = null; try { stmt = con.createStatement(); for (String sql : sqlArray) { stmt.addBatch(sql); } return stmt.executeBatch(); } finally { if (null != stmt) { stmt.close(); } } } public static int[] executeAsBatch(Connection con, String sql, Object[][] params) throws SQLException { PreparedStatement preStmt = null; try { preStmt = con.prepareStatement(sql); for (int i = 0; i < params.length; i++) { Object[] rowParams = params[i]; for (int k = 0; k < rowParams.length; k++) { Object obj = rowParams[k]; preStmt.setObject(k + 1, obj); } preStmt.addBatch(); } return preStmt.executeBatch(); } finally { if (null != preStmt) { preStmt.close(); } } } }