java.sql.SQLException: Value '0000-00-00 ' can not be represented as java.sql.Timest
来源:互联网 发布:c语言是开源的吗 编辑:程序博客网 时间:2024/05/17 23:03
在使用MySql 时, 数据库中的字段类型是timestamp的,默认为0000-00-00, 会发生异常:java.sql.SQLException: Value '0000-00-00 ' can not be represented as java.sql.Timestamp。
原因:“0000-00-00 00:00:00”在mysql中是作为一个特殊值存在的,而 java.sql.Date 将其视为 不合法的值 格式不正确因此产生异常。
解决办法:
jdbc的url加上zeroDateTimeBehavior参数:
如:jdbc.jdbcUrl=jdbc\:mysql\://127.0.0.1\:3306/hysdebugdb?useSSL\=false&zeroDateTimeBehavior=convertToNull
对于值为0000-00-00 00:00:00(默认值)的纪录,如下两种配置,会返回不同的结果:
(1)zeroDateTimeBehavior=round 0001-01-01 00:00:00.0
(2)zeroDateTimeBehavior=convertToNull null
阅读全文
0 0
- java.sql.SQLException: Value '0000-00-00 ' can not be represented as java.sql.Timest
- java.sql.SQLException: Value '0000-00-00 ' can not be represented as java.sql.Timest
- ibatis java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timest
- Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timest
- Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timest
- 解决Value '0000-00-00 ' can not be represented as java.sql.Timest
- Mysql 报错java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timest
- Err: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.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
- [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.Date .
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.D
- 问题解决:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- CentOS7 安装 zabbix-agentd
- CocosCreator 怎么添加JSB绑定的C++类到场景中
- Lisp运行程序
- Python之路【第5天】
- 根据给定的一系列整数关键字和素数p,用除留余数法定义hash函数H(Key)=Key%p,将关键字映射到长度为p的哈希表中,用线性探测法解决冲突。重复关键字放在hash表中的同一位置。
- java.sql.SQLException: Value '0000-00-00 ' can not be represented as java.sql.Timest
- nginx负载均衡和反向代理
- 机房之下机窗体
- spring定时任务.线程池,自定义多线程配置
- 获取img标签中的src内容
- mysql主从复制和mycat读写分离
- 习近平:实施国家大数据战略,加快建设数字中国(万字长文解读)
- 数据结构实验之查找一:二叉排序树
- vue双击事件-----两次快速的单击事件模拟双击事件