Here you can find the source of executeQueries(Connection conn, InputStream stream)
public static void executeQueries(Connection conn, InputStream stream) throws IOException, SQLException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; public class Main { public static void executeQueries(Connection conn, InputStream stream) throws IOException, SQLException { BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8"))); StringBuffer buf = new StringBuffer(); String line;//from ww w . j a v a2s . c o m while ((line = reader.readLine()) != null) { buf.append(line.trim()); } String[] queries = buf.toString().split(";"); Statement stmt = conn.createStatement(); for (String query : queries) { stmt.execute(query); } conn.commit(); stmt.close(); } }