使用PrepareStatement实现批量插入操作
方式一:
@Test
public void testQueryManyRecords(){
Connection connection = null;
PreparedStatement ps = null;
try {
long start = System.currentTimeMillis();
connection = JDBCUtils.getConnection();
String sql="insert into goods(name) values(?)";
ps = connection.prepareStatement(sql);
for(int i=1;i<=10000;i++){
ps.setObject(1,"admin"+i);
ps.executeUpdate();
}
long end=System.currentTimeMillis();
System