Java.sql.SQLException:Column count doesn ' t match value count at row 1

Source: Internet
Author: User
Tags aop

1. Exception prompt:

Cause:java.sql.SQLException:Column count doesn ' t match value count at row 1; Bad SQL Grammar []; Nested exception is Java.sql.SQLException:Column count doesn ' t match value count at row 1 at Org.springframework.jdbc. Support. Sqlstatesqlexceptiontranslator.dotranslate (sqlstatesqlexceptiontranslator.java:99) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( Abstractfallbacksqlexceptiontranslator.java:73) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( Abstractfallbacksqlexceptiontranslator.java:81) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( Abstractfallbacksqlexceptiontranslator.java:81) at Org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible ( Mybatisexceptiontranslator.java:73) at Org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke (Sqlsessiontemplate.java:446) at Com.sun.proxy. $Proxy 152.insert (Unknown Source) at Org.mybatis.spring.SqlSessionTemplate.insert (Sqlsessiont Emplate.java:278) at Org.apache.ibatis.binding.MapperMethod.execute (Mappermethod.java:57) at Org.apache.ibatis.binding.MapperProxy.invoke (Mapperproxy.java:59) at Com.sun.proxy. $Proxy 179.batchInsertMaterialEdit (Unknown Source) at sun.reflect.NativeMethodAccessorImpl.in VOKE0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection (Aoputils.java:333) at Org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint ( Reflectivemethodinvocation.java:190) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 157) at Org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke ( Persistenceexceptiontranslationinterceptor.java:136) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 179) at Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (Jdkdynamicaopproxy.java:213) at Com.sun.proxy. $Proxy 180.batchInsertMaterialEdit (Unknown Source) at Com.artup.service.impl.WorksServiceImpl . Saveworks (Worksserviceimpl.java:913) at Com.artup.controller.WorksController.saveWorks (Workscontroller.java:83) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (Invocablehandlermethod.java: 205) at Org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest ( Invocablehandlermethod.java:133) at Org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle ( Servletinvocablehandlermethod.java:116) at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod ( Requestmappinghandleradapter.java:827) at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal ( Requestmappinghandleradapter.java:738) at Org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle ( Abstracthandlermethodadapter.java:85) at Org.springframework.web.servlet.DispatcherServlet.doDispatch (Dispatcherservlet.java:963) at Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java:897) at Org.springframework.web.servlet.FrameworkServlet.processRequest (Frameworkservlet.java:970) at Org.springframework.web.servlet.FrameworkServlet.doPost (Frameworkservlet.java:872) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:661) at Org.springframework.web.servlet.FrameworkServlet.service (Frameworkservlet.java:846) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:742) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:231) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:52) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal ( Applicationcontextheaderfilter.java:55) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal ( Webrequesttracefilter.java:108) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.security.web.FilterChainProxy.doFilterInternal (Filterchainproxy.java:208) at Org.springframework.security.web.FilterChainProxy.doFilter (Filterchainproxy.java:177) at Org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (Delegatingfilterproxy.java:346) at Org.springframework.web.filter.DelegatingFilterProxy.doFilter (Delegatingfilterproxy.java:262) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.web.filter.RequestContextFilter.doFilterInternal (Requestcontextfilter.java:99) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal (Httpputformcontentfilter.java: 105) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (Hiddenhttpmethodfilter.java: 81) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (Characterencodingfilter.java: 197) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal (Metricsfilter.java:106) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.boot.web.support.ErrorPageFilter.doFilter (Errorpagefilter.java:115) at org.springframework.boot.web.support.errorpagefilter.access$(errorpagefilter.java:59) at org.springframework.boot.web.support.errorpagefilter$1.doFilterInternal (errorpagefilter.java:90) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.springframework.boot.web.support.ErrorPageFilter.doFilter (Errorpagefilter.java:108) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:198) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:96) at Org.apache.catalina.authenticator.AuthenticatorBase.invoke (Authenticatorbase.java:478) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:140) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:80) at Org.apache.catalina.valves.AbstractAccessLogValve.invoke (Abstractaccesslogvalve.java:624) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:87) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:342) at Org.apache.coyote.http11.Http11Processor.service (Http11processor.java:799) at Org.apache.coyote.AbstractProcessorLight.process (Abstractprocessorlight.java:66) at Org.apache.coyote.abstractprotocol$connectionhandler.process (Abstractprotocol.java:868) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun (Nioendpoint.java:1455) at Org.apache.tomcat.util.net.SocketProcessorBase.run (Socketprocessorbase.java:49) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1142) at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:617) at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (Taskthread.java:61) at Java.lang.Thread.run (Thread.java:748) caused By:java.sql.SQLException:Column count doesn' t match value count at row 1 at com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:964) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:3973) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:3909) at Com.mysql.jdbc.MysqlIO.sendCommand (Mysqlio.java:2527) at Com.mysql.jdbc.MysqlIO.sqlQueryDirect (Mysqlio.java:2680) at Com.mysql.jdbc.ConnectionImpl.execSQL (Connectionimpl.java:2501) at Com.mysql.jdbc.PreparedStatement.executeInternal (Preparedstatement.java:1858) at Com.mysql.jdbc.PreparedStatement.execute (Preparedstatement.java:1197) at Sun.reflect.GeneratedMethodAccessor232.invoke (Unknown Source) at Sun.reflect.DelegatingMethodAccessorImpl. Invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke (Preparedstatementlogger.java:59) at Com.sun.proxy. $Proxy 212.execute (Unknown Source) at Org.apache.ibatis.executor.statement.PreparedStatementH Andler.update (Preparedstatementhandler.java:46) at Org.apache.ibatis.executor.statement.RoutingStatementHandler.update (Routingstatementhandler.java:74) at Org.apache.ibatis.executor.SimpleExecutor.doUpdate (Simpleexecutor.java:50) at Org.apache.ibatis.executor.BaseExecutor.update (Baseexecutor.java:117) at Org.apache.ibatis.executor.CachingExecutor.update (Cachingexecutor.java:76) at Org.apache.ibatis.session.defaults.DefaultSqlSession.update (Defaultsqlsession.java:198) at Org.apache.ibatis.session.defaults.DefaultSqlSession.insert (Defaultsqlsession.java:185) at Sun.reflect.GeneratedMethodAccessor312.invoke (Unknown Source) at Sun.reflect.DelegatingMethodAccessorImpl. Invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke (Sqlsessiontemplate.java:433) ... 98 Common Frames omitted


2, Reason: from Java.sql.SQLException:Column count doesn ' t match value count at row 1 This paragraph describes what we can see is a SQL exception, that is, the number of fields in the insert operation does not match the number of values, the word to be inserted The number of segments must correspond to the corresponding value one by one.

3. Workaround: Check whether the field before values in the INSERT statement corresponds to whether the value after values is one by one, and the quantity and type must match one by one.

Java.sql.SQLException:Column count doesn ' t match value count at row 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.