今天系统报2个错如下

1.Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

2.Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

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

第一个我百度了以后,说是程序里实体的字段类型和数据库不匹配,我检查以后发现是匹配的没有问题。然后我就看报的第二个错,sqlException,Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

公司大佬告诉我在配置文件

spring.datasource.url的后面加上“&zeroDateTimeBehavior=convertToNull”就好了。我打开配置文件一看,果然配置文件spring.datasource.url中没有这么一句话。于是我半信半疑的把“&zeroDateTimeBehavior=convertToNull”加上了,果然好了!

原来是这样的:

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

在useSSL=false后面加上“&zeroDateTimeBehavior=convertToNull”就可以了,如下:

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

相关文章:

  • 2021-08-11
  • 2021-05-21
  • 2021-08-22
  • 2022-01-02
  • 2022-12-23
  • 2022-02-04
  • 2021-09-27
猜你喜欢
  • 2022-12-23
  • 2021-07-17
  • 2022-03-04
  • 2021-09-16
  • 2022-12-23
  • 2021-08-08
相关资源
相似解决方案