MySQL:数据截断:不正确的日期时间值:'2006-10-01 02:22:44' [英] MySQL: Data truncation: Incorrect datetime value: '2006-10-01 02:22:44'

查看:306
本文介绍了MySQL:数据截断:不正确的日期时间值:'2006-10-01 02:22:44'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在通过JDBC使用MySQL更新行时遇到以下异常:

I'm getting the following exception updating a row using MySQL via JDBC:

com.mysql.jdbc.MysqlDataTruncation:数据截断:不正确的日期时间值:'2006-10-01 02:22:44'

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '2006-10-01 02:22:44'

该列定义为:

'created_on_service时间戳为NULL默认为NULL'

'created_on_service timestamp NULL DEFAULT NULL'

该列上没有索引或外键.

There are no indexes or foreign keys on that column.

显然,数据类型不是问题.我在该表中具有该日期时间之前和之后的值.我还具有在2:22 AM之前和之后的时间值.

Obviously it's not a problem with data type. I have values in that table from both before and after that datetime. I also have values with times both before and after 2:22 AM.

推荐答案

已解决.

事实证明,2006年10月1日在南澳大利亚州开始了夏令时.时钟在凌晨2:00向前调一小时,因此该日期没有凌晨2:22:从凌晨2:00一直凌晨3:01.

Turns out that the 1st of October 2006 in South Australia was the start of daylight savings. Clocks get set forward one hour at 2.00am, so there was no 2:22am on that date: it went straight from 2:00am to 3:01am.

我将数据库时区更改为UTC,这将解决此问题.

I'll change the db timezone to UTC, which should solve this issue.

这篇关于MySQL:数据截断:不正确的日期时间值:'2006-10-01 02:22:44'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆