可更新resultset

可更新resultset,效率低

  1. //標準獲取Statement 方法 
  2. Statement stmt = (Statement) conn.createStatement(); 
  3.  
  4. //獲取可更新ResultSet 
  5. Statement stmt = (Statement) conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); 

 

  1. long s = System.currentTimeMillis(); 
  2. while(rs.next()){ 
  3. //調用其他的update方法 
  4. //  updateDate(conn,rs.getString("id")); 
  5.  
  6.     rs.updateString("age", rs.getString("id")); 
  7.     rs.updateRow(); // updates the row in the data source 
  8.     System.out.println(rs.getString("id")); 
  9. long e = System.currentTimeMillis(); 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章