Quantcast
Channel: Adobe AEM CQ tips » AEM/CQ5
Viewing all articles
Browse latest Browse all 8

Solution for SQLException :Value ‘0000-00-00′ can not be represented as java.sql.Date

$
0
0

Problem

The script throws

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

Solution

Solution for this problem is pretty simple. You just have to set the

zeroDateTimeBehavior

property via URI param. There are two options for this property

  • convertToNull(returns NULL instead of the date)
  • round (returns rounded date)

That means that your JDBC URI will look like this
jdbc:mysql://localhost/mydb?zeroDateTimeBehavior=round
and for the 0000-00-00 date value will return 0001-01-01.

Sources:
https://helpx.adobe.com/coldfusion/kb/mysql-error-java-sql-sqlexception.html
https://dev.mysql.com/doc/refman/5.0/en/connector-j-installing-upgrading.html#connector-j-installing-upgrading-3-0-to-3-1


Viewing all articles
Browse latest Browse all 8

Trending Articles