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 represented as java.sql.Timestamp.
2. 解决办法
给数据库的 jdbc.url 加上 zeroDateTimeBehavior 参数,如下:
jdbc.url=jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round
注意参数间不能有空格;否则报错 org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection
zeroDateTimeBehavior参数有两种配置:
- zeroDateTimeBehavior=round ,”0000-00-00“会默认转换为”0001-01-01 00:00:00”
- zeroDateTimeBehavior=convertToNull,“0000-00-00“会转换为null
MySQL 错误【四】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
java项目,使用MySQL,字段类型为timestamp,字段值默认为0000-00-00 00:00:00. 在解析数据时会抛出一个异常: java.sql.SQLException: Value ...
- 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;刚开始 ...
- 已解决: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 ...
- 关于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 分析: ...
- 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 ...
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
一.问题分析 问题 Error querying database. Cause: java.sql.SQLException: Value'0000-00-00 00:00:00' can not ...
最新文章
- 转帖:从C51的指针到病毒-c51软复位,经典,分析透彻
- 【转】解决IIS 用localhost需要用户名密码!
- 软件工程--第三周学习进度
- 软考广东有哪几个考点
- Matlab吸附等温线怎么拟合,吸附等温线线模型拟合
- 对jvm 同步锁的理解
- 前端学习(750):作用域导读
- 图深度学习论文笔记整理活动 | ApacheCN
- java图片特效轮播代码_JQuery实现图片轮播效果
- (10)进程---Manager数据共享
- PPT双屏抽奖,大气,能Hold住全场!与其它PPT内容可融为一体,实现无缝切换!
- 如何查看APP ID
- 密码学小知识(1):布隆过滤器(Bloom Filter)、混淆布隆过滤器(Garbled BF)和布谷鸟过滤器(Cuckoo Filter)
- 基于SSM实现个性化健康饮食推荐系统
- 计算机wps文字基础知识,计算机基础及WPS Office应用常见考试内容
- 3D打印机赋予了海岸生态系统极大的恢复能力
- 申请计算机语言学留学要求,布兰迪斯大学计算机语言学文学硕士研究生申请要求及申请材料要求清单...
- 账户经常被盗号怎么办?防盗“黑科技”了解一下
- Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager
- 2021年9月CISP-A(注册信息系统审计师)培训圆满结束