Solution hint value ' 0000-00-00 00:00:00 ' can not is represented as Java.sql.Timestamp;

Source: Internet
Author: User
Tags mysql in

MySQL in the query times a

Value ' 0000-00-00 00:00:00 ' can not is represented as Java.sql.Timestamp;

This error is due to the fact that it will insert ' 0000-00-00 00:00:00 ' when the default is to insert a time of type timestamp, but when the database is defined and because the design is a non-empty timestamp type, the query will be faulted. And the time frame for MySQL is: ' 1000-01-01 00:00:00‘ to '9999-12-31 23:59:59‘这个时间段,所以会报错,目前的解决办法是在jdbc连接文件中添加一句:

&zeroDateTimeBehavior=convertToNull

Url=jdbc:mysql://localhost:3306/seckill?useunicode=true&characterencoding=utf8&& Zerodatetimebehavior=converttonull

At present, this method is still useful, but in the back I do not know whether there will be new problems arise.

Solution hint value ' 0000-00-00 00:00:00 ' can not is represented as Java.sql.Timestamp;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.