美文网首页
org.springframework.jdbc.Uncateg

org.springframework.jdbc.Uncateg

作者: 牛哞哞杂记 | 来源:发表于2019-08-26 10:16 被阅读0次

    ssm连接数据库错误

    使用工具:eclipse

    数据库:mysql

    报错信息:org.springframework.jdbc.UncategorizedSQLException

    此错误的解决方法:将数据库的字符集修改为’utf8‘就行了。

    具体操作:

    步骤一(操作数据库):数据库右键–》编辑数据库—》字符集(选择utf8)

    步骤二(操作表):表右键—》设计表–》点击有可能会出现中文的字段–》字符集修改为utf8

    org.springframework.jdbc.UncategorizedSQLException错误

    报错详细信息如下:

    org.springframework.jdbc.UncategorizedSQLException:

    Error updating database. Cause: java.sql.SQLException: Incorrect string value: ‘\xE5\xA5\xB3’ for column ‘sex’ at row 1

    The error may involve com.tritonsfs.user.dao.UserManagerDAO.insert-Inline

    The error occurred while setting parameters

    SQL: insert into user ( id, name, password,age,sex,birthday,idcard ) values (, , , , , , )

    Cause: java.sql.SQLException: Incorrect string value: ‘\xE5\xA5\xB3’ for column ‘sex’ at row 1

    ; uncategorized SQLException; SQL state [HY000]; error code [1366]; Incorrect string value: ‘\xE5\xA5\xB3’ for column ‘sex’ at row 1; nested exception is java.sql.SQLException: Incorrect string value: ‘\xE5\xA5\xB3’ for column ‘sex’ at row 1

    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)

    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.SqlSessionTemplateSqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)atcom.sun.proxy.SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)atcom.sun.proxy.Proxy76.insert(Unknown Source)

    at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.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.Proxy77.insert(UnknownSource)atcom.tritonsfs.user.service.impl.UserManagerServiceImpl.insert(UserManagerServiceImpl.java:27)atcom.tritonsfs.user.service.impl.UserManagerServiceImplProxy77.insert(UnknownSource)atcom.tritonsfs.user.service.impl.UserManagerServiceImpl.insert(UserManagerServiceImpl.java:27)atcom.tritonsfs.user.service.impl.UserManagerServiceImplFastClassBySpringCGLIBFastClassBySpringCGLIB568e9a08.invoke(<generated>)atorg.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)atorg.springframework.aop.framework.CglibAopProxy568e9a08.invoke(<generated>)atorg.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)atorg.springframework.aop.framework.CglibAopProxyCglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)

    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)

    at com.tritonsfs.core.aspect.ServiceAspect.around(ServiceAspect.java:77)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)

    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)

    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)

    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

    at org.springframework.aop.framework.CglibAopProxyDynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)atcom.tritonsfs.user.service.impl.UserManagerServiceImplDynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)atcom.tritonsfs.user.service.impl.UserManagerServiceImplEnhancerBySpringCGLIBEnhancerBySpringCGLIB$c8650cbf.insert()

    at com.tritonsfs.user.service.impl.UserServiceTest.insert(UserServiceTest.java:41)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

    at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)

    at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)

    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)

    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)

    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)

    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)

    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)

    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

    at org.junit.runners.ParentRunnerKaTeX parse error: Expected 'EOF', got '\xE' at position 1088: …string value: '\̲x̲E̲5\xA5\xB3' for …Proxy90.execute(Unknown Source)

    at org.apache.ibatis.executor.statement.PreparedStatementHandler.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.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)

    … 56 more

    相关文章

      网友评论

          本文标题:org.springframework.jdbc.Uncateg

          本文链接:https://www.haomeiwen.com/subject/rhfrectx.html