欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Tim 异常解决办法

程序员文章站 2022-04-21 15:47:04
...

出现这个异常是由于数据库中关于 datetime 字段记录中出现了值为 0000-00-00 00:00:00 的一条记录,解决方法:删掉此条记录,或者更改为有效数据

Caused by: java.sql.SQLException: Value '0000-00-00 00:00:00'
 can not be represented as java.sql.Timestamp
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
at com.mysql.jdbc.ResultSetImpl.getTimestampFromString(ResultSetImpl.java:5705)
at com.mysql.jdbc.ResultSetImpl.getStringInternal
(ResultSetImpl.java:5338)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5167)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5206)
at com.alibaba.druid.filter.FilterChainImpl.resultSet_getString
(FilterChainImpl.java:907)
at com.alibaba.druid.filter.stat.StatFilter.resultSet_getString
(StatFilter.java:949)
at com.alibaba.druid.filter.FilterChainImpl.resultSet_getString(FilterChainImpl.java:905)
at com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl.getString(ResultSetProxyImpl.java:693)
at com.alibaba.druid.pool.DruidPooledResultSet.getString(DruidPooledResultSet.java:257)
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:37)
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:26)