mysql解决Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp
同步发布: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的更多相关文章
- 错误: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;刚开始 ...
- 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 ...
- '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 ...
- 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 ...
- 报错 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 ...
- 报错: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时,如果数据库中有 ...
- 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部分对应包含一个看 ...
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
1.问题场景描述:后台方法中执行查询返回list列表中,执行后台产生运行时异常 java.sql.SQLException: 2.问题排查和解决:排查代码,无编译时错误,断点调试,更具控制台找到对应的 ...
- 解决 SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp的问题
连接数据库时 设置:zeroDateTimeBehavior=convertToNull
随机推荐
- onTouch与onClick冲突解决方法
view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent ...
- HTTP协议 (三) 压缩
之前写过一个篇 [HTTP协议详解] ,这次继续介绍HTTP协议中的压缩. 本文会使用Fiddler来查看HTTP request和Response, 如果不熟悉这个工具,可以先参考[Fiddler教 ...
- 关于ref的一点理解
先写一段代码 class Test { public int Count { get; set; } } static void Main(string[] args) { Test test = } ...
- 使用navigator.geolocation来获取用户的地理位置信息
使用navigator.geolocation来获取用户的地理位置信息 W3C 中新添加了一个名为 Geolocation的 API 规范,Geoloaction API的作用就是通过浏览器获取用户的 ...
- ASP.NET中Cookies的使用
准备开始写后台代码了,不过刚看到cookies就傻眼了,网上搜集了一些资料,总结了一下,初学者可以看看. 创建COOKIES System.Web.HttpCookie cookie=new Http ...
- CPU的栈机制的一个小问题
比如要实现下面这个功能. 我们如果要在10000H处写入自行数据2266H,不能用“mov 内存单元, 寄存器”这类指令.怎么做? 代码: mov ax, 1000h mov ss, ax mov s ...
- pyqt4:连接的一个带有参数的方法
一般在pyqt4中的信号连接很少连接带参数的方法,很多时候连接带参数的方法节约不少代码量. self.s5_thread=scene.Worker5() self.log_get=QtCore.QTi ...
- python built-in zip()
zip([iterable, ...]) 返回一个list ,list里的元素是元组tuple.第i个元组内的元素是所有iteralbe中第i个元素组成的. 当所有的iterable拥有同样的长度的时 ...
- 《java编程思想》读书笔记(二)第五章(2)
成员初始化 Java尽力保证:所有变量在使用前都能得到恰当的初始化. 对于方法的局部变量,Java会以编译时报错的形式贯彻这种保证,比如: void f() { int i; //这里编译时就会报错, ...
- LeetCode-Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...