mysql datetime query the exception

Original link: http://www.cnblogs.com/niejunlei/p/5986766.html

MySQL  datetime query the exception

  • 异常:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp (2011-05-25 11:38:40)
  • Description: Non-empty default values ​​Datetime type field, the query procedure, to the following error: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
  • Solution: Add a database connection string zeroDateTimeBehavior parameters or noDatetimeStringSync parameters jdbc: mysql: // host:? Port / xxx ...

    • zeroDateTimeBehavior:取值exceptionconverToNullround
      • Exception --- throw an exception: the results java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp.
      • converToNull : return null value
      • round : return 0001-01-0100: 00: 00.0
    • noDatetimeStringSync : set to true, returns 0000-00-00 00:00:00

Reproduced in: https: //www.cnblogs.com/niejunlei/p/5986766.html

Guess you like

Origin blog.csdn.net/weixin_30698297/article/details/94795302