sam-tsai / activejdbc

Automatically exported from code.google.com/p/activejdbc
0 stars 0 forks source link

MySQL JDBC Memory Usage on Large ResultSet #190

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please, see 
http://benjchristensen.com/2008/05/27/mysql-jdbc-memory-usage-on-large-resultset
/ and  
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-note
s.html. 

Possible fix:
stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
              java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);
The combination of a forward-only, read-only result set, with a fetch size of 
Integer.MIN_VALUE serves as a signal to the driver to stream result sets 
row-by-row. After this, any result sets created with the statement will be 
retrieved row-by-row.

Original issue reported on code.google.com by art...@gmail.com on 6 Mar 2013 at 4:54