Home >Database >Mysql Tutorial >Mysql series (14) datetime query exception

Mysql series (14) datetime query exception

黄舟
黄舟Original
2017-01-22 17:06:201767browse

Mysql series (fourteen) datetime query exception

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

  • #Description: A non-empty Datetime type field with no default value, the program reports the following error when querying: Value ' 0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

  • Solution: Add zeroDateTimeBehavior parameter or noDatetimeStringSync parameter to the database connection string jdbc:mysql:/ /host:port/xxx?...

  • ##zeroDateTimeBehavior: value exception, convertToNull, round


  • exception---Exception thrown: Result java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql .Timestamp.

  • converToNull: Returns null value

  • round: Returns 0001-01-01 00:00:00.0



  • ##noDatetimeStringSync: Set to true, return 0000-00-00 00:00: 00
  • The above is the content of the datetime query exception in the Mysql series (fourteenth). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn