package fileDML;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class TxtInput0911 {
private static ArrayList<String> filelist = new ArrayList<String>();
public static void main(String[] args) throws Exception {
//表名的路径
String st = "C:\\Users\\Administrator\\Desktop\\createtable.txt";
getFiles(st);
}
static void getFiles(String filePath) {
File file= new File(filePath);
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String temp=null;
String order = "";
temp=br.readLine();
while(temp!=null){
order = "drop table if exists "+temp+";\n"+"create table " + temp +"(\n\n" +");";
temp=br.readLine();
System.out.println(order);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class TxtInput0911 {
private static ArrayList<String> filelist = new ArrayList<String>();
public static void main(String[] args) throws Exception {
//表名的路径
String st = "C:\\Users\\Administrator\\Desktop\\createtable.txt";
getFiles(st);
}
static void getFiles(String filePath) {
File file= new File(filePath);
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String temp=null;
String order = "";
temp=br.readLine();
while(temp!=null){
order = "drop table if exists "+temp+";\n"+"create table " + temp +"(\n\n" +");";
temp=br.readLine();
System.out.println(order);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}