stmt.executeBatch();
conn. commit (); //提交事务
long end = System.currentTimeMillis();
System.out.println(“插入20000条数据,耗时(毫秒):”+(end-start));
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}finally{
try {
if( rs !=null){
rs.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
try {
if(stmt!=null){
stmt.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
try {
if(conn!=null){
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}