Unable to get value for field 'x' of class 'java.sql.Timestamp'
[toc on_off::hide=1]
Issue:
When working on a MySQL DB and using fields of type "Datetime", you may in some cases encounter the following error when executing SELECT command:
Unable to get value for field 'x' of class 'java.sql.Timestamp'
Resolution:
It is a known problem of how JDBC driver handles "blank" date/time fields. As a workaround you can explicitly force JDBC driver to map these fields to null.
It can be done by adding:
zeroDateTimeBehavior=convertToNull
to the database connection string.
So it will look something like this:
jdbc:mysql://$SERVER/$DATABASE?zeroDateTimeBehavior=convertToNull
Adding this property should work the same for both JasperReports Server and iReport Designer.
Ref. Case #00025317 -- 11:37, 27 March 2012 (UTC)
Recommended Comments