记录一次mysql时间插入错误(Data truncation: Incorrect datetime value)

时间:2018-05-18 17:39:04   收藏:0   阅读:1056
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value

现象:能正常查询。但在插入datetime类型的字段报如下错误:
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: ‘‘ for column ‘crtTime‘ at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2868)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1160)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:685)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1400)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1314)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1299)

解决方法:将驱动由mysql-connector-java-5.0.3-bin.jar更新为mysql-connector-java-5.1.10-bin.jar 问题解决。

 

转载!!!!(所以说jar包还是要更新的。。。)

原文:https://www.cnblogs.com/donghongchao/p/9057105.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!