mysql数据库sql执行异常!

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(<generated>)
        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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值