title: Java - retrieving large amounts of data from a DB using iBatis
body: <p>I need to extract data from a DB2 table, run some processing on each returned row and output to a flat file. I'm using iBatis but found that using the <strong><em>queryForList</em></strong> I started getting out of memory errors, I'll be looking at 100k+ rows of data increasing. </p>
  
  <p>I've looked at using <strong><em>queryWithRowHandler</em></strong> instead but the iBatis <strong><em>RowHandler</em></strong> interface doesn't throw an exception from its <strong><em>handleRow</em></strong> function so if it gets an error I can't properly report it back and stop iterating the rest of the data. It looks like I can throw a RuntimeException but that doesn't strike me as a neat way of doing things. </p>
  
  <p>I'd like to be able to stop processing while throwing a meaningful Exception indicating whether the error occurred on the data manipulation, the file access or whatever.</p>
  
  <p>Has anyone had experience with this approach or have an alternative solution using iBatis. I know I could look to do this without iBatis, just using JDBC, but as iBatis is used for all other DB access in my app I'd like to avail of this architecture if possible.</p>