MySQL + Iterated/Streamed Query

Michael Gentry <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CAOy5kzPePuMu74nw9ya4W_na-aryjYFvjM3rgrvsLbaYxUSe8g@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.