Cannot convert value '0000-00-00 00:00:00' from column 10 to TIMESTAMP of the problem record

MYSQL:Cannot convert value ‘0000-00-00 00:00:00’ from column 10 to TIMESTAMP

If the date field in the database is empty and the value is '0000-00-00 00:00:00', the query will return: Cannot convert value '0000-00-00 00:00:00' from column 10 to TIMESTAMP

Solution:

Change the way to connect to the database

Add a parameter after connection: jdbc:mysql://127.0.0.1:3306/test

zeroDateTimeBehavior=convertToNull

That is to change to:

jdbc:mysql://127.0.0.1:3306/test?zeroDateTimeBehavior=convertToNul

Guess you like

Origin blog.csdn.net/weixin_42272869/article/details/113091091