When using Mysql with a large set of data an OutOfMemoryError error is raised.



By Default, the MySQL JDBC Driver retrieves all results in memory, which can be the cause of OOM issues when working with large sets of data.

See ResultSet paragraph at  for further information.

The solution is to indicate to the driver to process the row one by one, like explained in the MySql documentation.

To do that, set the fetch_size to the minimal Integer value. It can be done dynamically with the following rhino expression :