Java:出现错误提示(java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date)
Java:出现错误提示(java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date)
原因分析:
“0000-00-00 00:00:00”在mysql中是作为一个特殊值存在的,但 java.sql.Date 将其视为 不合法的值 格式不正确;
解决方案:
url加上zeroDateTimeBehavior参数(其中&是&的转义);
datasource.url=jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
注意:如果数据库连接是在xml中配置,需要进行特殊字符转义;

Java:出现错误提示(java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date)的更多相关文章
- 【异常】update更新java.sql.SQLException: Duplicate entry '2019-07-30 00:00:00-110100' for key
1 详细异常信息 User class threw exception: java.sql.SQLException: Duplicate entry '2019-07-30 00:00:00-110 ...
- Oracle java.sql.SQLException: 数字溢出
六月 30, 2016 5:47:47 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinit ...
- org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'alarmGroup' from result set. Cause: java.sql.SQLException: Error
异常展示: org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'alarmGroup ...
- java.sql.SQLException: ORA-00911: invalid character 解决方法
java.sql.SQLException: ORA-00911: invalid character 控制台抛出这个异常:java.sql.SQLException: ORA-00911: inva ...
- java.sql.SQLException: Access denied for user 'scott'@'localhost' (using password: YES)
今天用eclipse连接一下数据库,出现此异常. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using pa ...
- 解决sqoop导入报错:Caused by: java.sql.SQLException: Protocol violation
报错信息: -- ::, INFO [main] org.apache.hadoop.mapred.MapTask: Ignoring exception during close for org.a ...
- Linux中命令行编译java接口总是提示找不到符号的疑难杂症的解决
今天学习java的接口,在linux的命令行下写代码练练手吧,啪啪啪一顿猛敲,写了一个接口UsbInserface,UDisk继承UsbInterface,写完了那就编译到bin目录呗. 当时写程序的 ...
- java.sql.SQLException: ORA-00604: 递归 SQL 级别 1 出现错误
后台报出如下错误: Caused by: java.sql.SQLException: ORA-00604: 递归 SQL 级别 1 出现错误 ORA-01000: 超出打开游标的最大数 ORA-00 ...
- MySql系列:中文写入数据库出现错误java.sql.SQLException: Incorrect string value: '\xE5\xxxx' for column 'xxxx' at row 1及其解决方法
在将kft-activiti-demo的数据库连接改为mysql之后,可以正常登陆,但是在新建请假流程的时候出现如下错误: Caused by: java.sql.SQLException: In ...
随机推荐
- 应急分析异常通信的小思路和自己写的小工具(查询CNAME和A记录)
一.背景: 在很多时候,应急会发现.卧槽,异常连接,只有一个域名或者IP. 怎么办?上防火墙看记录,查域名对应的记录累成狗,自己把之前的代码改了改,写了个小工具,一条命令查询DNS相关记录,也可以指定 ...
- tcpdump linux抓http请求头
sudo tcpdump -i eth0 port 80 -s 1024 -l -A
- windows accounts
Some built-in groups are used for management purposes. You control which > users belong to these ...
- 关于HashSet在 java7 与 java8的不同
作者:RednaxelaFX链接:https://www.zhihu.com/question/28414001/answer/40733996来源:知乎著作权归作者所有.商业转载请联系作者获得授权, ...
- python学习笔记(四)— 函数
一.函数是什么? 函数一词来源于数学,但编程中的「函数」概念,与数学中的函数是有很大不同的,编程中的函数在英文中也有很多不同的叫法.在BASIC中叫做subroutine(子过程或子程序),在Pasc ...
- cpython解释器内存机制
java虚拟机内存 笼统分为两部分:堆区,栈区 其中,引用在栈区,对象在堆区 详细分为五部分:堆区,虚拟机栈区,本地方法栈区,方法区,程序计数器 cpython解释器内存 笼统分为两部分:堆区,栈区 ...
- Best Reward---hdu3613(manacher 回文串)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3613 题意就是给你一个串s 然后求把s分成两部分之后的价值总和是多少,分开的串 如果是回文那么价值就是 ...
- 最简单的win7、win8免费升级正版win10图文教程
https://www.microsoft.com/zh-cn/software-download/windows10 http://jingyan.baidu.com/article/19192ad ...
- DIV+CSS如何让文字垂直居中?
在说到这个问题的时候,也许有人会问CSS中不是有vertical-align属性来设置垂直居中的吗?即使是某些浏览器不支持我只需做少许的CSS Hack技术就可以啊!所以在这里我还要啰嗦两句,CSS中 ...
- C语言字符串/数组去重
输入: hello 输出: helo 第一种实现: 不新开数组, 也就是原地去重. #include <stdio.h> #include <string.h> void re ...