On 2/14/07, Peter Doyle <[EMAIL PROTECTED]> wrote:
I would like to make a request or offer to contribute something with regards error handling? Specifically, with regards to data extraction using the org.apache.ddlutils.platform.ModelBasedResultSetIterator class. As is, If this Iterators encounters an error when setting a Dynabean property it throws a generic DatabaseOperationException("Exception while reading the row from the resultset"). It occurs, in my case, when encountering an allowable (under mysql) but perhaps a bit unusual date value of "0000-00-00". The existing source code in question looks like this:
<snip>
I am suggesting at least more lax error handling around the value setting code (lines 253 - 255) as I use below (using some logging api wrapped with commons-logging) to just log the actual error message encountered ("[ERROR] ModelBasedResultSetIterator - Value '0000-00-00' can not be represented as java.sql.Date") and proceed with the extraction rather than just fail. An even better solution might be to declare a level for error handling (fail | warn | ignore perhaps) that could be specified as ant task attribute so the could would know how to handle the errors encountered more precisely.
The problem is that the MySql JDBC driver tries to map an illegal value to a java.sql.Date. Now the question is, how should this value be represented ? As null or as some Date ? The error handling is a different thing. I'd like to suggest that you create a JIRA issue for adding a failOnError=true/false mode for reading data from a database. Tom