关于Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp错误
mysql数据库中的字段类型datetime,通常是正常的时间类型比如2021-04-11 18:10:06或者null,
但有时候在导入数据的时候这个字段的值会变成0000-00-00 00:00:00,这种情况下查询就出现错误。
这是因为0000-00-00 00:00:00在数据库是允许出现的特殊值,但是会被jvm认为不合法的。
解决办法:
1、避免数据库出现这个时间
2、在数据库的链接url后加上zeroDateTimeBehavior,
例如:url=jdbc:mysql:***?zeroDateTimeBehavior=convertToNull
zeroDateTimeBehavior有3个值分别表示
convertToNull:出现时间0000-00-00 00:00:00时转为null
round:出现时间0000-00-00 00:00:00时转为0001-01-01 00-00-00
exception:默认值,抛出异常
关于Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp错误相关推荐
- mysql解决Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp
同步发布:http://www.yuanrengu.com/index.php/mysqlsolvetimestamp.html 在使用mysql时,如果数据库中的字段类型是timestamp,默认为 ...
- 错误:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp;的解决
问题: 代码中查询MySQL的结果集时报错,提示Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp;刚开始 ...
- 关于Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp异常问题的解读
前提 对于必传的字段, 新需求改为非必填的时候,在测试环境出现了 Value '0000-00-00 00:00:00' can not be represented as java.sql.Time ...
- java.sql.SQLException: Value ”0000-00-00 00:00:00“ can not be represented as java.sql.Timestamp
java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp 分析: ...
- 已解决:java.sql.SQLException: Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp
一.问题 一大早到公司 Mysql 中的一个 datetime 字段时碰到了一个 Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' c ...
- MySQL 错误【四】Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp
1. 错误描述 在使用mysql时,如果数据库中的字段类型是timestamp,默认为0000-00-00,会发生异常:Value '0000-00-00 00:00:00' can not be r ...
- Cause: java.sql.SQLExceptioValue ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp
今天使用mybatis创建demo测试的时候发现了一个有意思的bug org.apache.ibatis.exceptions.PersistenceException: ### Error quer ...
- Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp
程序使用select 语句查询数据时,出现以下异常: java.sql.SQLException:Value '0000-00-00' can not be represented as java.s ...
- MySQL错误:Value ‘0000-00-00 00:00:00‘ can not be represented as java.sql.Timestamp
java项目,使用MySQL,字段类型为timestamp,字段值默认为0000-00-00 00:00:00. 在解析数据时会抛出一个异常: java.sql.SQLException: Value ...
最新文章
- webservice gsoap 小记
- 想拿下互联网大厂OFFER,都需要准备什么?
- 【java】之常用四大线程池用法以及ThreadPoolExecutor详解
- iOS网络请求之multipart/form-data提交数据
- 一套不错的php,一套不错的PHP笔试题-附答案.pdf
- linux运行多线程语句,linux多线程中使用system函数后时而程序崩溃,求助!!!...
- TextView scrollbars setting
- Python3 编写处理Excel表格数据筛选脚本用到的一些方法
- 机器学习数学基础——群论
- 云服务器上安装 R语言 以及 RStudio Server 详细图文操作(全)
- 求助:用Python获取百度云服务access_token总是失败
- 不是吧阿sir,你不会还不知道Github可以当做Maven仓库吧
- 使用selenium爬取网易云热门评论(超详细)
- android 判断键盘是否弹起
- 电脑d盘和e盘不见了怎么恢复?
- 论文查重:降低重复率技巧
- 猫眼电影院爬虫(可用)
- w ndows10启动,手把手为你win10系统设置开机自动启动adsafe软件的详细教程
- 如何监测耳机/麦克风设备插拔操作
- 串讲数字电路与系统设计提前预告
热门文章
- 45页精华《2022中国建筑行业数字化转型研究报告》出炉(附下载)
- 华为OD机试题:身高体重排序
- html 在框架里弹出页面,iframe弹出新窗口 iframe页面打开新窗口问题
- An internal error occurred during: Validating SYYH. Java heap space
- 21天学会Linux----Day1:Linux环境搭建
- 让360浏览器强制优先使用极速模式
- 《安富莱嵌入式周报》第287期:下一代Windows12界面,支持各种工业以太网协议参考,百款在线电子开发工具,seL4安全微内核,旋转拨号手机,PSP掌机逆向
- TCGA数据库的利用(二)—— 数据处理
- Cisco ❀ ICMP-互联网控制报文协议
- Redis详解之特殊数据类型GEO及底层数据结构