java.sql.SQLException: Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp
来源:互联网 发布:高速微型数据连接器 编辑:程序博客网 时间:2024/06/06 12:37
从别的项目得到一段mysql的建表语句,执行时报错:there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause。
结果是低版本的mysql只允许有一个字段把CURRENT_TIMESTAMP设为默认值。解决方法有两个:
1.升级mysql
2.只设置一个。
我选择了第二种,结果数据库中就出现了“0000-00-00 00:00:00”这种时间。而该值在java中被视为不合法。
解决方法:在jdbc的url加上 zeroDateTimeBehavior参数。
例:
原:jdbc.url=jdbc:mysql://127.0.0.1:3306/ssm
改:jdbc.url=jdbc:mysql://127.0.0.1:3306/ssm?zeroDateTimeBehavior=convertToNull
阅读全文
0 0
- Err:java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
- [DEBUG] “java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp”
- java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
- “java.sql.SQLException: Value '0000-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
- 异常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
- 关于SQLException:Value'0000-00-00 00:00:00'can not be represented as java.sql.Timestamp的问题
- 问题解决:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date 解决方法
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- 问题解决:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- java.sql.SQLException:Value ‘0000-00-00′ can not be represented as java.sql.Date .
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.D
- jstl报错ye:javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String
- 递归和非递归实现二叉树前序遍历
- 关于Unity中的UGUI优化,你可能遇到这些问题
- 【ubuntu】安装tensorRT
- 1.python实现循环执行目标目录下脚本文件
- java.sql.SQLException: Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp
- 又一家“小微公司”从海尔毕业,他们做的是扫地机器人
- 【文本描述增强】标准屏幕字段文本描述更改增强
- java实现小程序开发(二)
- Java 线程简介
- 值得你学习的 Android 开发规范
- maven和gradle对比
- 腾讯安全反病毒实验室:小心隐私生活被直播!
- 马斯克:中美俄之间的 AI 霸权争夺可能会引发第三次世界大战