您的位置 首页 java

java JDBC 批量插入数据

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();

}

}

}

文章来源:智云一二三科技

文章标题:java JDBC 批量插入数据

文章地址:https://www.zhihuclub.com/184441.shtml

关于作者: 智云科技

热门文章

发表回复

您的电子邮箱地址不会被公开。

网站地图