1

In our Queries we have large resultsets. We want to implement a streaming mechanic like:

//repeat split times
for( int i = 0 ; i < split ; i++){
    //Fetch some records
    //Send fetched records
    //continue at next cursorposition
}

Now this works well for:

results = query.scroll();

But due to some circumstances we may need to work with a ResultSet from

ResultSet results = preparedStatement.executeQuery();

I can now also iterate also over the ResultSet:

results.next()

Now afaik:
The ScrollableResults does the recordfetching depending on the cursorposition, which would mean, i could send data already while more data is being fetched.

The ResultSet already fetches the complete data at once, and i could start with the sending of data only afterwards.

My Question is, am i right with this assuming, or does the ResultSet.next() work similar to the ScorllableResults.next()?

Background is: I want to be able to send some required data, before the complete resultset is being fetched (processed).

Gobliins
  • 3,848
  • 16
  • 67
  • 122

0 Answers0