Here you can find the source of loadSqlFile(String path)
This method return the sql scripts from the given sql file.
Parameter | Description |
---|---|
path | the path of the sql file |
Parameter | Description |
---|---|
IOException | if fails to read the sql file |
private static String[] loadSqlFile(String path) throws IOException
//package com.java2s; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main { /**// w w w. java 2 s . c om * <p> * This method return the sql scripts from the given sql file. * </p> * * @param path the path of the sql file * @return the sql scripts * * @throws IOException if fails to read the sql file */ private static String[] loadSqlFile(String path) throws IOException { StringBuffer sb = new StringBuffer(); BufferedReader reader = new BufferedReader(new FileReader(path)); try { String line = reader.readLine(); while (line != null) { line = line.trim(); if (line.length() != 0 && !line.startsWith("--")) { sb.append(line); } line = reader.readLine(); } return sb.toString().split(";"); } finally { reader.close(); } } }