Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
好久没记录了,最近一直在忙着工作以及码前后端 记录下这种大多数人都会碰到但是又不一定找得到问题的错误
1 Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

一般是数据库表设计字段为DateTime类型时数据库默认给了0000-00-00这种默认值,在数据库看来是合法合理的,但是在jvm中并不认可
因此,做法无非就是让他输出的默认值变为 null 或者 有正确的默认值输出
解决方法也很简单:在数据库链接后加上 &zeroDateTimeBehavior=convertToNull 这样输出默认值为null 就不会报错了

Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp的更多相关文章
- Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String'
错误异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'socialCode' in 'class java.lang.String'
异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Refl ...
- nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'enterpriseId' in 'class java.lang.String'
错误信息: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for p ...
- JSON parse error: default constructor not found. class java.time.YearMonth; nested exception is com.alibaba.fastjson.JSONException: default constructor not found. class java.time.YearMonth
java8新出的YearMonth可以方便的用来表示某个月.我的项目中使用springmvc来接收YearMonth类型的数据时发现 x-www-from-urlencoded 格式的数据可以使用&q ...
- bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL ...
- SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: InlineParameterMap
<select id="getResByName" resultClass="Resources" parameterClass="java.l ...
- nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.
无法将"0000-00-00 00:00:00"转换为TIMESTAMP 2017-05-08 00:56:59 [ERROR] - cn.kee.core.dao.impl.Ge ...
- Failed to convert from type [java.lang.String] to type [java.util.Date] for value '2020-02-06'; nested exception is java.lang.IllegalArgumentException]解决
今天做springbook项目前端输入日期传到数据库保存报了一下错误 Whitelabel Error Page This application has no explicit mapping fo ...
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
异常信息如下: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value ...
- 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value
先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...
随机推荐
- Javaweb学习笔记第七弹
Maven依赖范围 对于Maven的安装配置等环境准备问题,可详细参考我的前几篇博客, 网址1:https://www.cnblogs.com/liuzijin/p/16654344.html 网址2 ...
- kubernetes集成GPU原理
这里以Nvidia GPU设备如何在Kubernetes中管理调度为例研究, 工作流程分为以下两个方面: 如何在容器中使用GPU Kubernetes 如何调度GPU 容器中使用GPU 想要在容器中的 ...
- 声网推出首个完整实时合唱解决方案 即将上线“咪哒”全国线下K歌房
4月20日,声网Agora宣布对实时合唱技术方案全面升级,帮助国内知名迷你KTV品牌"咪哒"实现国内首个支持多终端.多人合唱.高音质的完整实时合唱解决方案的落地,结束了国内K歌行业 ...
- 一起听、一起看、一起唱掀起Z世代青年社交浪潮
6月5日,声网Agora 联合人人都是产品经理在成都举办了主题为"社交泛娱乐APP运营增长力和新玩法解析"的沙龙.现场围绕社交泛娱乐新玩法解析以及出海的新机遇.支付痛点.增长.运营 ...
- Centos 7配置使用nginx反向代理mysql
背景:由于WEB服务和MySQL数据库服务分开部署的,由于网络问题限制,有时需要通过中间代理服务器跳转连接MySQL,所以需要在中间服务器上配置代理. 1.添加stearm模块 # nginx通常代理 ...
- Java并发夺命50问
本文已经收录到Github仓库,该仓库包含计算机基础.Java基础.多线程.JVM.数据库.Redis.Spring.Mybatis.SpringMVC.SpringBoot.分布式.微服务.设计模式 ...
- 基于列存储的开源分布式NoSQL数据库Apache Cassandra入门分享
@ 目录 概述 定义 特性 与Hbase对比 Cassandra使用场景 术语 架构 概览 Dynamo 数据集分区使用令牌环的一致性哈希 存储引擎 部署 单实例部署 集群部署 CQL 概述 数据模型 ...
- 好饭不怕晚,Google基于人工智能AI大语言对话模型Bard测试和API调用(Python3.10)
谷歌(Google)作为开源过著名深度学习框架Tensorflow的超级大厂,是人工智能领域一股不可忽视的中坚力量,旗下新产品Bard已经公布测试了一段时间,毁誉参半,很多人把Google的Bard和 ...
- 提供一款局域网聊天小工具,对接了chatGPT3.5
账号.密码随便填,只要自己能记住就可以,网络地址如效果图(本机IP地址+8080端口),效果图如下 服务地址用本机IP,端口可以随便用一个,如8888,填完记得点击按钮开启: 通讯地址如果你有其他人的 ...
- ACM-学习记录-数据结构-1
AOJ-ALDS1_1_D Maximum Profit 本题主要考虑要将复杂度降到O(n),否则过不了最后五组数据 #include<iostream> #include<bits ...