2019独角兽企业重金招聘Python工程师标准>>>
- public class Test {
- public static void main(String[] args) throws SQLException {
- Connection conn = WLMGlobal.connMgr_stat_instance().getConnection();
- Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
- ResultSet rs = stmt.executeQuery("select distinct logid from stat_data");
- rs.last(); //结果集指针知道最后一行数据
- int n = rs.getRow();
- System.out.println(n);
- rs.beforeFirst();//将结果集指针指回到开始位置,这样才能通过while获取rs中的数据
- while(rs.next()){
- System.out.println(rs.getInt(1));
- }
- }
- }