mysql 数据库字段为datetime类型时默认值为:0000-00-00 00:00:00 查询时异常 java.sql.SQLException:Value '0000-00-00' can not be represented as java.sq

来源:互联网 发布:如何查询淘宝买家信誉 编辑:程序博客网 时间:2024/05/16 11:56

mysql
数据库字段为datetime类型时默认值为:0000-00-00 00:00:00
查询时异常
java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
解决方法在url后添加 &zeroDateTimeBehavior=convertToNull
datasource.url=jdbc:mysql://localhost:3306/pe?useUnicode=true&characterEncoding=gbk&zeroDateTimeBehavior=convertToNull

原创粉丝点击