Menu

Value '0000-00-00' can not be represented as java.sql.Date

Eder Jorge
2015-12-21
2016-10-05
  • Eder Jorge

    Eder Jorge - 2015-12-21

    This happens when connecting to mysql, because mysql considers 0000-00-00
    as a valid date and java.sql.Date doesn't.

    To fix it, add a ?zeroDateTimeBehavior=convertToNull to your jdbc url
    connection, and this value for date will be null and valid for Java.

    i.e.: jdbc:mysql://<host>:<port3306>/<database>?zeroDateTimeBehavior=convertToNull

    Cheers,
    Eder

     
  • Eder Jorge

    Eder Jorge - 2015-12-22

    My bad, it is really the same solution. :-(. I've made a search and didn't look right all the results.
    You can delete if you want.
    Eder

     

Anonymous
Anonymous

Add attachments
Cancel