无法将“0000-00-00 00:00:00”转换为TIMESTAMP

2017-05-08 00:56:59 [ERROR] - cn.kee.core.dao.impl.GeneralDaoImpl -GeneralDaoImpl.java(100) -GeneralDao getEntity with sql has failed! select * from user_base where userName = ? org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [ select * from user_base where userName = ? ]; Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.; nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.

我会在这里猜测你正在使用MySQL :-)它使用“零日期”作为特殊的占位符 - 不幸的是,JDBC默认情况下无法处理它们。

解决方案是将“zeroDateTimeBehavior = convertToNull”指定为MySQL连接的参数(在数据源URL或附加属性中),例如:

 jdbc:mysql://localhost/myDatabase?zeroDateTimeBehavior=convertToNull

这将导致所有这些值被检索为NULL。

nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.的更多相关文章

  1. nested exception is java.sql.SQLException: Incorrect string value: '\xE7\x99\xBB\xE9\x99\x86...' for column 'image' at row 1

    HTTP Status 500 - Hibernate operation: could not insert: [cn.itcast.shop.product.vo.Product]; uncate ...

  2. nested exception is java.sql.SQLException: IO 错误

    1.错误描述 (mx.messaging.messages::ErrorMessage)#0 body = (null) clientId = "18CE3B03-9709-9DA8-763 ...

  3. Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connectio

    严重: StandardWrapper.Throwableorg.springframework.transaction.CannotCreateTransactionException: Could ...

  4. 2016.11.10 Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver

    运行项目rds_web时,出现错误提示:Could not get JDBC Connection; nested exception is java.sql.SQLException: No sui ...

  5. Could not get JDBC Connection; nested exception is java.sql.SQLException: ${jdbc.driver}

    在一个SSM分布式项目中一个服务报错: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnec ...

  6. 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value

    先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...

  7. 报错: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out. 数据库连接超时

    解决方法一: [oracle@data ~]$ sqlplus / as sysdba——连接到数据库 SQL*Plus: Release 11.2.0.4.0 Production on Mon M ...

  8. ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to chec

    数据库连接超时,是数据库连接时的相关配置写错,例如:数据库密码,驱动等问题

  9. hibernate查询oracle数据库表报错SQL state [null]; error code [17027]; 流已被关闭; nested exception is java.sql.SQLException: 流已被关闭

    把表字段类型 long 修改为 number类型即可

随机推荐

  1. 111_climbing-stairs

    /*@Copyright:LintCode@Author:   Monster__li@Problem:  http://www.lintcode.com/problem/climbing-stair ...

  2. lua 字符串

    lua 字符串 语法 单引号 双引号 "[[字符串]]" 示例程序 local name1 = 'liao1' local name2 = "liao2" lo ...

  3. PHP弱类型语法的实现

    PHP弱类型语法的实现 前言 借鉴了 TIPI, 对 php 源码进行学习 欢迎大家给予意见, 互相沟通学习 弱类型语法实现方式 (弱变量容器 zval) 所有变量用同一结构表示, 既表示变量值, 也 ...

  4. 自定义TextView跑马灯

    本篇主要介绍TextView的可控制跑马灯效果实现. Android自带的TextView添加几个属性就可以实现跑马灯效果,大概是这样 android:ellipsize="marquee& ...

  5. Fullcalendar 日历控件的基本使用

    1:Fullcalendar 日历控件的基本简介 Fullcalendar是一款十分强大的开源日历免费控件,提供了丰富的属性设置和方法调用. 官网地址:https://fullcalendar.io/ ...

  6. Lambda表达式和Lambda表达式树

    LINQ的基本功能就是创建操作管道,以及这些操作需要的任何状态. 为了富有效率的使用数据库和其他查询引擎,我们需要一种不同的方式表示管道中的各个操作.即把代码当作可在编程中进行检查的数据. Lambd ...

  7. 在Debian 8 上安装自动化工具Ansible

    如果你是新手,就不要犹豫了,ansible是你最好的选择,本人菜鸟一个.废话少说,开始安装! 实验环境: 192.168.3.190 192.168.3.191 192.168.3.192 192.1 ...

  8. WebGIS开源解决方案之矢量数据导入

    前几篇介绍了开源WebGIS开发环境的搭建,本篇开始陆续介绍这些软件的使用,WebGIS的开发,首要的问题是解决数据来源,本篇主要介绍矢量数据在开源空间数据库PostgreSQL中的存储.后续篇幅中再 ...

  9. 【NLP】3000篇搜狐新闻语料数据预处理器的python实现

    3000篇搜狐新闻语料数据预处理器的python实现 白宁超 2017年5月5日17:20:04 摘要: 关于自然语言处理模型训练亦或是数据挖掘.文本处理等等,均离不开数据清洗,数据预处理的工作.这里 ...

  10. 北漂面试经历(一(两)年工作经验)-- Java基础部分

    Java基础部分 常量和变量的区别:final 关键词修饰的变量是恒定不变的,如果还有static关键词修饰的话,常常称为编译期常量.变量,运行时可以修改其引用. Java基本类似有哪些 1 Byte ...