mysql datetime查询异常

异常:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp (2011-05-25 11:38:40)

描述:非空无默认值的Datetime类型字段,查询时程序报以下错误: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

解决方法:数据库连接串添加zeroDateTimeBehavior参数或者noDatetimeStringSync参数jdbc:mysql://host:port/xxx?...

  • zeroDateTimeBehavior:取值exceptionconverToNullround

    • exception---抛出异常:结果java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp。

    • converToNull:返回null

    • round:返回0001-01-01 00:00:00.0

  • noDatetimeStringSync:设置为true,返回0000-00-00 00:00:00

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
  • 2021-06-24
猜你喜欢
  • 2022-12-23
  • 1970-01-01
  • 2021-09-15
  • 2021-08-20
  • 2021-09-20
  • 2021-12-28
  • 2021-07-01
相关资源
相似解决方案