JDBC considers the default MySQL datetime value invalid

Source: Internet
Author: User

Today, I want to use kettle to extract a table with 30 million records. I 'd like to take a brief look at Kettle's extraction efficiency. I don't want to report an error when extracting data to 7999 rows. View logs:

"

... Couldn't get row from result set...

... Value '2017-00-00 'can not be represented as Java. SQL. timestamp...

"

At first, I did not pay attention to the following time issues. I focused on "couldn't get row from result set" and found some online materials, increase MySQL net_write_out and cancel "use result streaming cursor" in kettle's "DB connection", but the error still persists. It seems that they are not a problem.

When the problem cannot be solved, I began to pay attention to the following error. I queried the 7999 rows where the error was stopped, it is found that from this line, this time field has a null value and '2017-00-00 00:00:00 'value in addition to the normal time data. Is this type of value caused by errors, after you query the relevant information, you will know that JDBC (default Act) considers that a date and time value such as null or '2017-00-00 'is invalid. To avoid this problem, edit the JDBC connection attribute and add the following attribute values:

Zerodatetimebehavior = converttonull 

When designing related tables in the production system, it is best not to use a value like '2017-00-00 'by default.

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.