FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
May 01, 2005

Processing Rows in Batches

(Page 4 of 5)
May, 2005: Processing Rows In Batches

void topNRows( Connection db ) {
    String someQuery = "SELECT X, Y, Z FROM SOMETABLE ORDER BY X";
    int N= 100;
    Statement firstN= db.prepareStatement( someQuery );
    ResultSet rs= firstN.executeQuery();
    for( int i= 0; i != N && rs.next(); ++i ) {
        // process the row
    }
    // assert (N rows processed) or (no more rows)
    rs.close();
    firstN.close();
}

Example 3: Java partial fetch.

Previous Page | 1 | 2 | 3 | 4 | 5 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK