I\'m getting the following exception updating a row using MySQL via JDBC:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: \
My problem was caused by DST, too. I've fixed it by changing column data type from timestamp
to datetime
. This answer describes the difference, in short:
INSERT
/UPDATE
and different SELECT
results. Some time points are invalid due to DST;Note: you may still have to deal with "missing" time. This approach just shifts responsibility from DB level to application level.
See also: MySQL documentation for TIMESTAMP vs DATETIME
Solved it.
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.
I'll change the db timezone to UTC, which should solve this issue.
You did not show exact update SQL. But may be you forget the date part
The correct format is yyyy-mm-dd hh:mm:ss format
Date value should be in following format 2011-11-01 12:32:01
We upgraded MySQL server but didnt upgrade the mysql connector jar. We encountered this issue. Later I figured out it was due to the old jar. I upgraded it and this issue went away.
I fixed the same problem (com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'perev_start_time' at row 1
) by upgrading my MySQL connector JAR, and copying the mysql.jar to the Tomcat lib directory.
The version of MySQL Server is 5.6 and the MySQL connector is mysql-connector-java-5.1.30-bin.jar
.