There's a database it consists of two million records approximately inside a table . and that i went the query from the java code such as this " choose * from table" . does it fetch the entire data in the database within the result set . or otherwise . If so then the way it works i wish to discover the focusing on this retrieveal ,

Please tell me , i've learnt somewhere that it'll retrieve the entire data in the database and can store within the temporary storage after that it'll show within the output .Could it be fine . Or perhaps is there something connected to J2C

Here's nearly exactly the same question. How to handle huge result sets from database

You request whether it will fetch the entire dataset. it'll. therefore, it's advised not to fetch the entire database. Here's something about where it's saved java - mysql - select query outfile - where is file getting saved

Does it fetch the entire data in the database within the result set

There's no precise response to it. It's usually determined by the database driver. The end result set is definitely an Interface and it is implementation is performed with a specific database driver. The ResultSet implementation may have its very own optimisation in which for more compact group of data, things are fetched where for bigger datasets, its buffered (or some default paging mechanism). So please make reference to the database driver documentation.

There's a typical (a minimum of the javadoc states so) way to avoid the fetching of huge data from database. Set the right fetch size for that JDBC statement the following java.sql.Statement.setFetchSize().

Because the java doc

Provides the JDBC driver an indication regarding the quantity of rows that needs to be fetched in the database when more rows are essential. The amount of rows specified affects only result sets produced by using this statement. When the value specified is zero, then your hint is overlooked. The default value is zero.

Hope this can help.