???JDBC???????????????????
???????????? ???????[ 2013/9/5 11:11:06 ] ????????
???????jdbc??????????100000?????????????statement??PreparedStatement????PreparedStatement+??????3???????в????
????1?????statement????100000?????
????public void exec(Connection conn){
????try {
????Long beginTime = System.currentTimeMillis();
????conn.setAutoCommit(false);//?????????
????Statement st = conn.createStatement();
????for(int i=0;i<100000;i++){
????String sql="insert into t1(id) values ("+i+")";
????st.executeUpdate(sql);
????}
????Long endTime = System.currentTimeMillis();
????System.out.println("st??"+(endTime-beginTime)/1000+"??");//???????
????st.close();
????conn.close();
????} catch (SQLException e) {
????// TODO Auto-generated catch block
????e.printStackTrace();
????}
????}
????2?????PreparedStatement????
????public void exec2(Connection conn){
????try {
????Long beginTime = System.currentTimeMillis();
????conn.setAutoCommit(false);//?????
????PreparedStatement pst = conn.prepareStatement("insert into t1(id) values (?)");
????for(int i=0;i<100000;i++){
????pst.setInt(1?? i);
????pst.execute();
????}
????conn.commit();
????Long endTime = System.currentTimeMillis();
????System.out.println("pst:"+(endTime-beginTime)/1000+"??");//???????
????pst.close();
????conn.close();
????} catch (SQLException e) {
????// TODO Auto-generated catch block
????e.printStackTrace();
????}
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11