1.Statement()批量处理(11119毫秒10000条数据)
@Test
public void testStatement() throws Exception {
Connection connection = null;
Statement statement =null;
try {
connection = JDBCTools.getConnection();
statement = connection.createStatement();
String sql = "";
long begin = System.currentTimeMillis();
for(int i = 0; i< 10000; i++){
sql = "INSERT INTO CUSTOMERSS(ID ,NAME ,EMAIL ,BRITH,CORE ) VALUES ("+(i+1)+",'"+(i+1)+"_name','"+(i+1)+"_EMAIL','19-04-15',100)";
System.out.println(sql);
statement.executeUpdate(sql);
}
long end = System.currentTimeMillis();
System.out.println(end-begin);
} catch (Exception e) {
e.printStackTrace();
} fially {
JDBCTools.colse(statement, connection, null);
}
}
2.PrepareStatement()批量处理&