主类:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.sql.*;
import java.util.ArrayList;
public class Test {
private static Connection connection;
private static Statement statement;
private Table currentTable;
private static int count=0;
public static void main(String[] args){
Test test = new Test();
test.getConn();
for (int i = 2; i<= 288; i++){
String index;
if (i<10) {
index = "00" + i;
}else if (i<100){
index = "0" + i;
} else {
index = "" + i;
}
String tableName = "20170301_" + index;
System.out.println(tableName + " is running...");
test.createTable(tableName);
test.readFile(tableName);
System.out.println("sum: " + test.countTable(tableName));
}
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
private void getConn() {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/taxi