Java examples for java.sql:Statement
execute Batch Query from a File
import java.sql.*; import java.io.*; public class Main{ public static void executeBatchQuery(Connection con, String scriptFile) { Statement st;/*from ww w .j a va 2 s. co m*/ BufferedReader br; String line; try { br = FileUtil.getTextReader(scriptFile); st = con.createStatement(); while ((line = br.readLine()) != null) { System.out.println(line); st.executeUpdate(line); } System.out.println("Done!"); } catch (Exception e) { e.printStackTrace(); } } }