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 ...
最新文章
- 2008年 浙工大考研计算机专业课试题C++
- 每天一个linux命令(50):crontab命令
- python 学习 我推荐这本书,适合特别没有程序基础或者编程思维较差的人,
- 微服务系列实践 .NET CORE
- SprinBoot 集成 Flowable/Activiti工作流引擎
- 11-Docker Bridge详解
- Python打印某范围内的素数
- 鸿蒙系统深度解析,深度解析鸿蒙内核最重要的结构体
- Log4j2日志框架集成Slf4j日志门面
- centos 时区正确,时间不对
- 说服力:从场景化出发的用户价值
- java设计模式——adapter模式
- 1一10到时的英文单词_[1-10的英语单词读音]1到10的英语单词
- KDD cup 2017 高速公路收费站交通流量预测 中文翻译(转载)
- java中case怎么用,Java中case使用示例,Javacase使用示例,switch([vari
- jQuery手风琴图片轮播(源码+注释)
- 亲戚B (普通并查集)
- “南京才不相信互联网呢”
- python 怎么输出实际的根号2_Python怎么输出根式?
- BST、AVL、BTree、B+Tree、B*Tree、23Tree、234Tree、TTree、RBTree、LLRBTree、AATree、SplayTree、Treap、无旋Treap、scap
热门文章
- 绕过AMSI详细指南:如何利用DLL hijack轻松绕过AMSI
- 一次 WebResource.axd 异常处理经历
- 帷幄匠心 c++ qt岗位,一二三四面 2个半小时
- win7计算机管理无用户账户,win7系统控制面板中用户账户显示空白的解决方法
- 建博第一天。。。希望每天都有进步,,加油!!!如你的昵称!!!
- 解决:给 VSCode 手动添加(解压压缩包)相关插件的问题
- 雅诗兰黛中国创新研发中心在上海揭幕;安联贸易任命中国区行政总裁 | 美通企业日报...
- 【Hadoop】HDFS文件写入与文件读取过程
- Zigbee,esp8266(wifi),蓝牙协议三种通信方式
- KE-之单机案例分析