I want to fetch 50 records from table which contains millions of record without using limit
I did following
private void createMYSQLConnection() throws SQLException {
        CachedRowSet crs = new CachedRowSetImpl();
        Connection conn = null;
        Statement stmt = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/mydb",
                    "root", "root");
            conn.setAutoCommit(false);
            crs.setPageSize(100);
            crs.setUsername("root");
            crs.setPassword("Glass4#21");
            crs.setCommand("SELECT * FROM trn_22_gouk_final_attendance");
            crs.absolute(10);
            crs.setFetchSize(10);
            crs.execute(conn);
            while (crs.next()) {
                System.out.println(crs.getObject(1));
            }
        } catch (SQLException se) {
            se.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            crs.close();
        }
    }
but it not works... any suggestion
Thanks in advance