Discussion:
MysqlDataTruncation - Incorrect datetime
(too old to reply)
Magnus Warker
2013-06-25 09:09:46 UTC
Permalink
Hi,

my mysql server reported the following error today:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime
value: ''2013-06-25 11:01:02'' for column 'end' at row 1

The column has the type 'datetime' and contains already many values of
the form 'YYYY-MM-DD HH:MM:SS'.

If I execute an update command manually, I am also able to insert the
above value into the table.

The format is correct. So what is the problem?

Thanks
Magnus
Erick T. Barkhuis
2013-06-25 09:21:17 UTC
Permalink
Post by Magnus Warker
Hi,
Hi Magnus,
Post by Magnus Warker
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect
datetime value: ''2013-06-25 11:01:02'' for column 'end' at row 1
Did you copy/paste this error message?
(I am stumped by the pairs of single quotes; did you type them
yourself?)
--
Erick
Magnus Warker
2013-06-25 09:52:11 UTC
Permalink
Post by Erick T. Barkhuis
Post by Magnus Warker
Hi,
Hi Magnus,
Post by Magnus Warker
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect
datetime value: ''2013-06-25 11:01:02'' for column 'end' at row 1
Did you copy/paste this error message?
(I am stumped by the pairs of single quotes; did you type them
yourself?)
Yes, I copied it from the error message dialog box.

Magnus
--
This is Unix-Land. In quiet nights, you can hear the Windows machines
reboot.
Tony Mountifield
2013-06-25 10:52:21 UTC
Permalink
Post by Magnus Warker
Post by Erick T. Barkhuis
Post by Magnus Warker
Hi,
Hi Magnus,
Post by Magnus Warker
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect
datetime value: ''2013-06-25 11:01:02'' for column 'end' at row 1
Did you copy/paste this error message?
(I am stumped by the pairs of single quotes; did you type them
yourself?)
Yes, I copied it from the error message dialog box.
It looks like you have included quotes in the date/time string itself.
i.e. you are giving it "'2013-06-25 11:01:02'" instead of
"2013-06-25 11:01:02".

Check your JDBC API.

Cheers
Tony
--
Tony Mountifield
Work: ***@softins.co.uk - http://www.softins.co.uk
Play: ***@mountifield.org - http://tony.mountifield.org
Magnus Warker
2013-06-26 08:11:15 UTC
Permalink
Post by Tony Mountifield
It looks like you have included quotes in the date/time string itself.
i.e. you are giving it "'2013-06-25 11:01:02'" instead of
"2013-06-25 11:01:02".
Right! This was the reason...
Thanks
Magnus
--
This is Unix-Land. In quiet nights, you can hear the Windows machines
reboot.
Loading...