同步发布:http://www.yuanrengu.com/index.php/mysqlsolvetimestamp.html

  在使用mysql时,如果数据库中的字段类型是timestamp,默认为0000-00-00,会发生异常:Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp.

解决办法如下:

给数据库的jdbc.url加上zeroDateTimeBehavior参数,如下:

jdbc.url=jdbc:mysql://localhost:3306/table?characterEncoding=UTF-8&zeroDateTimeBehavior=round

 zeroDateTimeBehavior参数有两种配置:

  • zeroDateTimeBehavior=round ,”0000-00-00“会默认转换为”0001-01-01 00:00:00”
  • zeroDateTimeBehavior=convertToNull,“0000-00-00“会转换为null

mysql解决Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp的更多相关文章

  1. 错误:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp;的解决

    问题: 代码中查询MySQL的结果集时报错,提示Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp;刚开始 ...

  2. java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

    下面是我查询数据库时打印出来的异常信息: ### Error querying database.  Cause: java.sql.SQLException: Value '0000-00-00 0 ...

  3. '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp error

    '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp error 异常现象 ### Cause: java.sql.SQ ...

  4. Caused by: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

    错误信息如下: Caused by: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java ...

  5. 报错 java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp 原因

    sql异常 java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestam ...

  6. 报错:java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

    感谢原文作者:风起云淡- 原文链接:https://blog.csdn.net/shenguan777/article/details/78615521 异常分析: 在使用MySql时,如果数据库中有 ...

  7. JEECG中出现Java.sql.SQLException: Value 'xxxx' can not be represented as java.sql.Timestamp的解决办法

    出现`Java.sql.SQLException: Value 'xxxx' can not be represented as java.sql.Timestamp',其中xxxx部分对应包含一个看 ...

  8. Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

    1.问题场景描述:后台方法中执行查询返回list列表中,执行后台产生运行时异常 java.sql.SQLException: 2.问题排查和解决:排查代码,无编译时错误,断点调试,更具控制台找到对应的 ...

  9. 解决 SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp的问题

    连接数据库时 设置:zeroDateTimeBehavior=convertToNull

随机推荐

  1. 关于IIS服务器证书续订

    输入办证机构+服务器名或IP 办证机构可以通过certsrv.msc来查看 输入完后点完成

  2. PowerDesigner中Name与Code同步的问题

    转自:http://blog.sina.com.cn/u/48932504010005t9 PowerDesigner中,但修改了某个字段的name,其code也跟着修改,这个问题很讨厌,因为一般来说 ...

  3. LintCode Interleaving String

    Given three strings: s1, s2, s3, determine whether s3 is formed by the interleaving of s1 and s2. Ex ...

  4. js MATH

    MATH Math 对象用于执行数学任务. 无需创建它,通过把 Math 作为对象使用就可以调用其所有属性和方法. Math 对象属性 var a=Math.E; //输出2.718281828459 ...

  5. 编译.NET项目的时候报错错误“ResGen.exe”已退出,代码为 -1073741701

    解决的办法如下: 1.关闭所有Visual Studio: 2.以管理员的身份打开命令提示窗口:(开始-运行-cmd)         //有人说要使用vs tools 里面的控制台 亲试无卵用 3. ...

  6. Django 创建APP简单步骤

    yum install epel-releaseyum install python34yum install python-pippip install django django-admin st ...

  7. ✡ leetcode 172. Factorial Trailing Zeroes 阶乘中的结尾0个数--------- java

    Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...

  8. WINDOW(单调队列的应用)

    给你一个长度为 N 的数组,一个长为 K 的滑动的窗体从最左移至最右端, 你只能见到窗口的K个数,每次窗体向右移动一位,如下表: 你的任务是找出窗口在各位置时的 max value,min value ...

  9. 分享一个ruby网站 | 菜鸟教程

    http://www.runoob.com/ruby/ruby-tutorial.html 分享一个ruby网站.

  10. relative

    进行relative定位后的元素,不会影响原本的文本流. 下图左列的第二张图是进行了margin-top取负值,右列第二张图进行了relative定位