• com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value


    1、错误描述

    严重: Servlet.service() for servlet [springmvc] in context with path [/cip] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [delete from t_student where stu_id in (?) or tea_id in (?) ]; Data truncation: Truncated incorrect DOUBLE value: '18,16,15,38,14,13,12,11,10,184,9,8,7,6,5,4,3,1,69,70,71,72,73,74,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214'; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '18,16,15,38,14,13,12,11,10,184,9,8,7,6,5,4,3,1,69,70,71,72,73,74,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214'] with root cause
    com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '18,16,15,38,14,13,12,11,10,184,9,8,7,6,5,4,3,1,69,70,71,72,73,74,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214'
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3885)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
    	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2141)
    	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077)
    	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062)
    	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2723)
    	at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1069)
    	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)
    	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)
    	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:145)
    	at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:253)
    	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:916)
    	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:909)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:909)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:970)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:980)
    	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
    	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
    	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(Ab
    stractHttp11Processor.java:1091)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    	at java.lang.Thread.run(Thread.java:745)

    2、错误描述

    private static final String SQL_DELETE = "delete from t_student where stu_id in (?) or tea_id in (?) ";
    
    
    this.getJdbcTemplate().update(SQL_DELETE, stuId,teaId);
          where后面的查询条件利用in,这样会导致出错

    3、解决办法

    private static final String SQL_DELETE = "delete from t_student where stu_id in ";
    
    
    StringBuffer sql = new StringBuffer();
    sql.append(SQL_DELETE).append("(").append(stuId)
       .append(") or tea_id in(").append(teaId).append(")");
    this.getJdbcTemplate().update(sql.toString());


  • 相关阅读:
    好用的PHP读取EXCEL类
    PHP获取函数参数数组
    在 Win7 下运行 TC 2.0 / TC3.0 / BC 3.1 / QB 4.5 等 DOS 开发工具
    用PHP生成等比图像的方法
    判断当前发布日期是否超过今天
    HTTP响应代码中文详解
    __autoload自动加载函数
    __isset魔术方法
    php下载远程文件类(支持断点续传)
    用PHP保存从摄像头拍下来的图片
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13313869.html
Copyright © 2020-2023  润新知