java.sql.SQLException: Value'0000-00-00'错误解决方法
来源:互联网 发布:苹果电脑清理垃圾软件 编辑:程序博客网 时间:2024/05/17 08:03
java.sql.SQLException: Value'0000-00-00'错误解决方法
java.sql.SQLException: Value'0000-00-00'异常解决办法
在使用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
MySQL数据库,如果数据库中Date字段为空为值为'0000-00-00"时,Hibernate的生成类时就会报错,解决方案为在数据库连接后面加上
"jdbc:mysql://192.168.7.178:3306/cy useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true"即可,呵呵! ----我用这个解决了该问题。
- java.sql.SQLException: Value'0000-00-00'错误解决方法
- java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date 解决方法
- java.sql.SQLException: Value'0000-00-00'异常解决
- java.sql.SQLException: Value'0000-00-00'异常解决办法
- java.sql.SQLException: Value'0000-00-00'异常解决办法
- java.sql.SQLException: Value'0000-00-00'异常解决办法[转]
- java.sql.SQLException: Value'0000-00-00'异常解决办法
- 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
- [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
- java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql
- Android Studio实现代码混淆
- php中需要注意的问题
- 字母A-Z的快速定位滑块的学习研究
- 设计模式-可复用面向对象软件的基础 [读书笔记]
- web.xml详解
- java.sql.SQLException: Value'0000-00-00'错误解决方法
- BestCoder Round #80(B)高精度
- Android控件架构与自定义控件(一)
- 《JS权威指南》学习笔记(三):表达式和运算符
- 国内从事机器视觉领域的公司(转)
- c++搜索二叉树的基本操作
- 机器学习笔记03:Normal equation与梯度下降的比较
- Oracle笔记(一) Oracle简介及安装(oracle10g)
- nefu500网购【二分+网络流】