1 public static CachedRowSetImpl getRowSet(String sql){ 2 Connection conn = null; 3 PreparedStatement prep = null; 4 ResultSet rs = null; 5 CachedRowSetImpl rowset = null; 6 try { 7 conn = getConnection(); 8 rowset = new CachedRowSetImpl(); 9 prep = conn.prepareStatement(sql); 10 rs = prep.executeQuery(); 11 rowset.populate(rs); 12 } catch (Exception e) { 13 e.printStackTrace(); 14 }finally{ 15 close(prep,conn); 16 } 17 return rowset; 18 }
相关分类