Yeah, had to deal with this before. While there's no API to directly access the Statement (I think we should introduce it just in case), there is an alternative: add "useCursorFetch=true" URL parameter and use "ObjectSelect.statementFetchSize(..)".
Andrus > On Mar 14, 2020, at 5:31 PM, Michael Gentry <blackn...@gmail.com> wrote: > > I'm trying to do an iterated query (using the 4.1 RC) against MySQL and it > appears that the MySQL JDBC driver loads everything into memory first > instead of streaming results. This results in memory-related exceptions > for larger results. > > From searching, it appears that the MySQL JDBC driver needs the following > hint to stream results: > > statement = > connection.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, > java.sql.ResultSet.CONCUR_READ_ONLY); > statement.setFetchSize(Integer.MIN_VALUE); > > Is there an easy way to get the iterated query to provide that hint when > getting a connection? I've not found a way yet. Best I've found so far is > to swap out a whole slew of classes to change the DataSource that's > actually returned. > > Thanks, > > mrg