mysql系列(十四)datetime查询异常
异常:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp (2011-05-25 11:38:40)
描述:非空无默认值的Datetime类型字段,查询时程序报以下错误: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
解决方法:数据库连接串添加zeroDateTimeBehavior参数或者noDatetimeStringSync参数jdbc:mysql://host:port/xxx?...
zeroDateTimeBehavior:取值exception、converToNull、round
exception---抛出异常:结果java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp。
converToNull:返回null值
round:返回0001-01-01 00:00:00.0
noDatetimeStringSync:设置为true,返回0000-00-00 00:00:00
以上就是Mysql系列(十四)datetime查询异常的内容,更多相关内容请关注PHP中文网(www.php.cn)!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号