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)的更多相关文章

  1. 【异常】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 ...

  2. Oracle java.sql.SQLException: 数字溢出

    六月 30, 2016 5:47:47 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinit ...

  3. 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 ...

  4. java.sql.SQLException: ORA-00911: invalid character 解决方法

    java.sql.SQLException: ORA-00911: invalid character 控制台抛出这个异常:java.sql.SQLException: ORA-00911: inva ...

  5. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using password: YES)

    今天用eclipse连接一下数据库,出现此异常. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using pa ...

  6. 解决sqoop导入报错:Caused by: java.sql.SQLException: Protocol violation

    报错信息: -- ::, INFO [main] org.apache.hadoop.mapred.MapTask: Ignoring exception during close for org.a ...

  7. Linux中命令行编译java接口总是提示找不到符号的疑难杂症的解决

    今天学习java的接口,在linux的命令行下写代码练练手吧,啪啪啪一顿猛敲,写了一个接口UsbInserface,UDisk继承UsbInterface,写完了那就编译到bin目录呗. 当时写程序的 ...

  8. java.sql.SQLException: ORA-00604: 递归 SQL 级别 1 出现错误

    后台报出如下错误: Caused by: java.sql.SQLException: ORA-00604: 递归 SQL 级别 1 出现错误 ORA-01000: 超出打开游标的最大数 ORA-00 ...

  9. 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 ...

随机推荐

  1. css做鼠标指向图片图片放大但边框不放大

    这是一个圆形边框做的效果 HTML <div class="circle-wrapper"> <img src="" > </di ...

  2. 如何访问局域网的Access数据库?

    1]用共享打印机来打开文件共享, 2]把Access文件.mdb所在的文件夹 共享,然后其他的就和本地一样了. 设置如下: Data Source="\\192.168.7.49\user\ ...

  3. 【BZOJ3417】Poi2013 Tales of seafaring 分层图BFS

    [BZOJ3417]Poi2013 Tales of seafaring Description 一个n点m边无向图,边权均为1,有k个询问 每次询问给出(s,t,d),要求回答是否存在一条从s到t的 ...

  4. 基于开源博客系统(jpress)搭建网站

    基于开源博客系统(jpress)搭建网站 JPress 使用 Java8 开发,基于流行的JFinal和Jboot框架. 目前JPress已经内置的文章和页面其实是两个模块,可以移除和新增其他模块,因 ...

  5. onbeforeunload 适用DOM 0级,不适用 DOM 2级

    你可以在控制台试下: window.addEventListener("beforeunload", function () { return 'ss'; }); 我这里 chro ...

  6. Liunx新手入门必看

    安装CentOS(Linux的一个常用发行版本,互联网公司经常使用这个发行版)用到的软件: VMware_workstation_full_12.5.2.exe 虚拟机软件,虚拟机由这个软件安装.管理 ...

  7. 背景图片拉伸显示CSS

    .divbackimg{ width:150px; height:50px; background-image:url(./btn.png); -moz-background-size: 100% 1 ...

  8. Abp Uow 设计

    初始化入口 在AbpKernelModule类中,通过UnitOfWorkRegistrar.Initialize(IocManager) 方法去初始化 /// <summary> /// ...

  9. js当前页面刷新并且清空文本内容的方法

    js当前页面刷新并且清空文本内容的方法: 1.js代码:location.reload(); 2.html:<body onload="document.forms[0].reset( ...

  10. WeQuant交易策略—EMV

    EMV指标策略 简介 EMV(Ease of Movement Value, 简易波动指标),它是由RichardW.ArmJr.根据等量图和压缩图的原理设计而成, 目的是将价格与成交量的变化结合成一 ...