Jump to content
We've recently updated our Privacy Statement, available here ×
  • 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)  


    User Feedback

    Recommended Comments

    The solution does not work for me on Oracle database - when adding above String, I have the connection exception: "ORA-12505, TNS:listener does not currently know of SID given in connect descriptor".
    I also tried adding this as property on "Connection Properties" tab, but with no effect.

    Link to comment
    Share on other sites

    Hi Ewa,

    The solution posted here is specific to MySQL database. The property zeroDateTimeBehavior is proprietary to MySQL and it wouldn't be recognized by Oracle.

    If you are getting this (or any other) error on Oracle, I would suggest posting the question in the 'Answers' section of this website.

    Thanks

    Link to comment
    Share on other sites



    Guest
    This is now closed for further comments

×
×
  • Create New...