public class SqlExecutor {
private static final Logger log = LoggerFactory.getLogger(SqlExecutor.class);
public static void main(String[] args) {
//从文件中读取sql,并处理sql
List<String> list = readSqlFromFile();
//批量处理sql语句
executeBatchSql(list);
}
private static List readSqlFromFile(){
BufferedReader in = null;
//--- 1.首先从文件里面读取数据,----但是注意:文件路径需要走配置
String filePath = getProperties("filePath");
log.info("sql数据的来源:"+filePath);
List<String> sqlList = new ArrayList<String>();
try {
File file = new File(filePath);
in = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line = "";
while((line = in.readLine())!=null){
if (!"".equals(line))
sqlList.add(line);
}
log.info("将从文件里面读取的数据,有"+sqlList.