解决Value '0000-00-00 ' can not be represented as java.sql.Timest
来源:互联网 发布:nasa直播软件 编辑:程序博客网 时间:2024/04/30 15:14
在使用MySql 时, 数据库中的字段类型是timestamp的,默认为0000-00-00, 会发生异常:java.sql.SQLException: Value '0000-00-00 ' can not be represented as java.sql.Timestamp
解决办法:
给jdbc url加上 zeroDateTimeBehavior参数:
datasource.url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
zeroDateTimeBehavior=round是为了指定MySql中的DateTime字段默认值查询时的处理方式;默认是抛出异常,
对于值为0000-00-00 00:00:00(默认值)的纪录,如下两种配置,会返回不同的结果:
zeroDateTimeBehavior=round 0001-01-01 00:00:00.0
zeroDateTimeBehavior=convertToNull null
解决办法:
给jdbc url加上 zeroDateTimeBehavior参数:
datasource.url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
zeroDateTimeBehavior=round是为了指定MySql中的DateTime字段默认值查询时的处理方式;默认是抛出异常,
对于值为0000-00-00 00:00:00(默认值)的纪录,如下两种配置,会返回不同的结果:
zeroDateTimeBehavior=round 0001-01-01 00:00:00.0
zeroDateTimeBehavior=convertToNull null
0 0
- 解决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
- 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
- Mysql 报错java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timest
- 解决java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date
- 解决:java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- 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 .
- scala 元组tuple的几个知识点-提供分
- 【设计模式】简单工厂模式——以一个简单的计算器为例
- Android Service生命周期 Service里面的onStartCommand()方法详解
- 跟着9张思维导图学习Javascript
- Validform 验证
- 解决Value '0000-00-00 ' can not be represented as java.sql.Timest
- Android中常用的位图操作(View与Bitmap转化、圆角、灰化、提取Alpha、旋转、倒影、剪切……)
- android典型代码系列(三)------数据库URI收集
- Fatal error encountered during command execution
- Eclipse中使用lombok
- 优秀项目经理的六个习惯
- android典型代码系列(四)------android全屏代码
- Hibernate的多对一
- iOS 获取通讯录联系人信息