java.sql.SQLException: Zero date value prohibited
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.
at com.encdata.oss.service.impl.push.search.service.DataSearchServiceBz.testConnect(DataSearchServiceBz.java:136)
at com.encdata.oss.service.impl.push.search.controller.DataSearchController.testConnect(DataSearchController.java:62)
at com.encdata.oss.service.impl.push.search.controller.DataSearchController$$FastClassBySpringCGLIB$$93e0b72f.invoke(
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.encdata.oss.starter.annotation.validate.aspect.ValidateInterceptor.interceptor(ValidateInterceptor.java:54)
at sun.reflect.GeneratedMethodAccessor214.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
表数据
INSERT INTO `enc_original_database`.`shujuxji`(`kid`, `code`, `created`, `status`, `type`, `xxrksj`, `bz`, `zjlid`) VALUES ('1239456659177345024', '1', 20200316154110, 0, '请假表单', '0000-00-00 00:00:00', '1594777485106', '36497c5f5bb3dd222d6550614669dbbf');
INSERT INTO `enc_original_database`.`shujuxji`(`kid`, `code`, `created`, `status`, `type`, `xxrksj`, `bz`, `zjlid`) VALUES ('2223333', '3', 34234235566, 1, '湖北', '2020-07-22 10:16:24', '1594777485106', 'a6134f5e1f1975c48715c8816f878924');
INSERT INTO `enc_original_database`.`shujuxji`(`kid`, `code`, `created`, `status`, `type`, `xxrksj`, `bz`, `zjlid`) VALUES ('3', '3', 3, 2, '的', '2020-07-15 10:16:15', '2', '3');
表结构
CREATE TABLE `shujuxji` (
`kid` text COMMENT 'kid',
`code` text COMMENT 'code',
`created` bigint(20) DEFAULT NULL COMMENT 'created',
`status` int(11) DEFAULT NULL COMMENT 'status',
`type` text COMMENT 'type',
`xxrksj` datetime DEFAULT NULL COMMENT '信息入库时间',
`bz` text COMMENT '备注',
`zjlid` text COMMENT '主记录id',
KEY `xxrksjsy` (`xxrksj`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='中文名称'
出错原因:
表中操作时间类型数据且数据为0000-00-00 00:00:00
修改方式:
在jdbc的URL中添加 &zeroDateTimeBehavior=convertToNull