### Error updating database. Cause: java.sql.SQLException: Incorrect integer value: ‘**‘ for column
Type Exception Report
Message Request processing failed; nested exception is org.apache.ibatis.exceptions.PersistenceException:
Description The server encountered an unexpected condition that prevented it from completing the request.
Exceptions
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLException: Incorrect integer value: '刘文' for column 'name' at row 1
### The error may exist in com/bjpowernode/dao/StudentDao.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: insert into student(name,age) values(?,?)
### Cause: java.sql.SQLException: Incorrect integer value: '刘文' for column 'name' at row 1
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.sql.SQLException: Incorrect integer value: '刘文' for column 'name' at row 1
### The error may exist in com/bjpowernode/dao/StudentDao.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: insert into student(name,age) values(?,?)
### Cause: java.sql.SQLException: Incorrect integer value: '刘文' for column 'name' at row 1
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
com.sun.proxy.$Proxy14.insert(Unknown Source)
org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
com.sun.proxy.$Proxy15.insertStudent(Unknown Source)
com.bjpowernode.service.impl.StudentServiceImpl.addStudent(StudentServiceImpl.java:19)
com.bjpowernode.controller.StudentController.addStudent(StudentController.java:26)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
java.sql.SQLException: Incorrect integer value: '刘文' for column 'name' at row 1
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:371)
com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:498)
org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
com.sun.proxy.$Proxy14.insert(Unknown Source)
org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
com.sun.proxy.$Proxy15.insertStudent(Unknown Source)
com.bjpowernode.service.impl.StudentServiceImpl.addStudent(StudentServiceImpl.java:19)
com.bjpowernode.controller.StudentController.addStudent(StudentController.java:26)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
):Note that the full stack information for the main issue can be viewed in the server logs
Solution:
The reason is that I mistakenly wrote the name type as int type. Open navicate to find the created table, right-click to find the design table, and change the name type to varchar
Read More:
- [Solved] Error updating database. Cause: java.sql.SQLException: Unknown initial character set index ‘255‘ re
- [Solved] mybatis Error querying database. Cause: java.sql.SQLException: The server time zone value
- Error querying database.Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource.
- [Solved] IDEA jdbc Connect Database Error: java.sql.SQLException: Undefined Error
- [Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty
- Java.sql.sqlexception: unable to read more data from socket
- [How to Fix]java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x82\xF0\x9F…’
- [Solved] java.sql.SQLException: Unsupported character encoding ‘utf-8
- [Solved] JAVA Operate Database Error: You have an error in your SQL syntax; Dao layer SQL statement error
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- [Solved] java.sql.SQLException: Unknown system variable cache query size
- [Solved] Error attempting to get column ‘xxxx_time‘ from result set. Cause: java.sql.SQLFeatureNotSupportedEx
- [Solved] java.sql.SQLException: Table ‘xxx.hibernate_sequence’ doesn’t exist
- JAVA Error: Error attempting to get column ‘XXX’ from result set. Cause java.sql.
- API Failed to Connect phoenix Error: java.sql.SQLException: ERROR 726 (43M10): Inconsistent namespace mapping properties
- Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #2 of SELECT list is no
- [Solved] swagger Docmentation Access Error: Illegal DefaultValue 1024 for parameter type integer, java.lang.NumberFormatException
- [How to Solve Error]java.util.Date cannot be cast to java.sql.Date
- [Solved] Java.lang.ClassCastException: [Ljava.lang.Long; cannot be cast to java.util.List
- When the database table field is set to self incrementing, use the entity class to insert or update the data to solve the error (Hibernate Framework)