You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/06/19 08:06:15 UTC

[GitHub] [shardingsphere] ljz0721cx commented on issue #6123: use mysql on duplicate key update not support

ljz0721cx commented on issue #6123:
URL: https://github.com/apache/shardingsphere/issues/6123#issuecomment-646501293


   > Can you provide log of sql.show?
   ```
   2020-06-19 16:03:46.020  INFO 29036 --- [           main] c.t.ocenter.service.RecordServiceTest    : Started RecordServiceTest in 11.732 seconds (JVM running for 12.614)
   Creating a new SqlSession
   SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1b66d1] was not registered for synchronization because synchronization is not active
   JDBC Connection [org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.ShardingConnection@e4db59] will not be managed by Spring
   ==>  Preparing: SELECT business_no, boot_type, occurrence_time, gmt_create, gmt_modify, records FROM transbill_records WHERE business_no = ? and boot_type= ? 
   ==> Parameters: 76576568(String), 1(Integer)
   <==    Columns: business_no, boot_type, occurrence_time, gmt_create, gmt_modify, records
   <==        Row: 76576568, 1, 2020-06-19 11:29:32, 2020-06-19 11:29:32, 2020-06-19 03:46:39, <<BLOB>>
   <==      Total: 1
   Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1b66d1]
   Creating a new SqlSession
   SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@fe6c5] was not registered for synchronization because synchronization is not active
   JDBC Connection [org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.ShardingConnection@1780b5c] will not be managed by Spring
   ==>  Preparing: INSERT INTO transbill_records ( business_no, occurrence_time, gmt_create, gmt_modify, records ) values ( ?, ?, ?, ?, ? ) on duplicate key update records= CONCAT_WS(';',records,?) 
   ==> Parameters: 76576568(String), 2020-06-19 11:29:32.0(Timestamp), 2020-06-19 11:29:32.0(Timestamp), 2020-06-19 03:46:39.0(Timestamp), {"key":"我的排队","value":"768768"};{"key":"我的排队","value":"768768"};{"key":"我的排队","value":"768768"}(String), {"key":"我的排队","value":"768768"};{"key":"我的排队","value":"768768"};{"key":"我的排队","value":"768768"}(String)
   Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@fe6c5]
   
   org.springframework.jdbc.BadSqlGrammarException: 
   ### Error updating database.  Cause: java.sql.SQLException: No value specified for parameter 6
   ### The error may exist in file [D:\myworkers\workspace\ocenter\ocenter-dao\target\classes\mapper\RecordMapper.xml]
   ### The error may involve com.thclouds.ocenter.mapper.RecordMapper.appends-Inline
   ### The error occurred while setting parameters
   ### SQL: INSERT INTO transbill_records          ( business_no,                                           occurrence_time,                                           gmt_create,                                           gmt_modify,                                           records )           values ( ?,                                           ?,                                           ?,                                           ?,                                           ? )          on duplicate key update         records= CONCAT_WS(';',records,?)
   ### Cause: java.sql.SQLException: No value specified for parameter 6
   ; bad SQL grammar []; nested exception is java.sql.SQLException: No value specified for parameter 6
   
   	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
   	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:88)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440)
   	at com.sun.proxy.$Proxy114.insert(Unknown Source)
   	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:271)
   	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
   	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:144)
   	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
   	at com.sun.proxy.$Proxy118.appends(Unknown Source)
   	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.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
   	at com.sun.proxy.$Proxy119.appends(Unknown Source)
   	at com.thclouds.ocenter.server.service.RecordService.appendByBusinessNo(RecordService.java:33)
   	at com.thclouds.ocenter.service.RecordServiceTest.TestappendByBusinessNo(RecordServiceTest.java:43)
   	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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
   	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
   	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
   	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
   	at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
   	at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
   	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
   	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:366)
   	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$4.run(ParentRunner.java:331)
   	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
   	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
   	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
   	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
   	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
   	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
   	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
   	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
   	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
   	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
   	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
   	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
   	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
   Caused by: java.sql.SQLException: No value specified for parameter 6
   	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
   	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
   	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
   	at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:398)
   	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
   	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
   	at org.apache.shardingsphere.shardingjdbc.executor.SQLExecuteCallbackFactory$2.executeSQL(SQLExecuteCallbackFactory.java:62)
   	at org.apache.shardingsphere.shardingjdbc.executor.SQLExecuteCallbackFactory$2.executeSQL(SQLExecuteCallbackFactory.java:58)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback.execute0(SQLExecuteCallback.java:82)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteCallback.execute(SQLExecuteCallback.java:58)
   	at org.apache.shardingsphere.underlying.executor.engine.ExecutorEngine.syncExecute(ExecutorEngine.java:97)
   	at org.apache.shardingsphere.underlying.executor.engine.ExecutorEngine.parallelExecute(ExecutorEngine.java:93)
   	at org.apache.shardingsphere.underlying.executor.engine.ExecutorEngine.execute(ExecutorEngine.java:76)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteTemplate.execute(SQLExecuteTemplate.java:68)
   	at org.apache.shardingsphere.sharding.execute.sql.execute.SQLExecuteTemplate.execute(SQLExecuteTemplate.java:51)
   	at org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor.executeCallback(AbstractStatementExecutor.java:129)
   	at org.apache.shardingsphere.shardingjdbc.executor.PreparedStatementExecutor.execute(PreparedStatementExecutor.java:148)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:145)
   	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.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
   	at com.sun.proxy.$Proxy154.execute(Unknown Source)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
   	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 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.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
   	at com.sun.proxy.$Proxy153.update(Unknown Source)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
   	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.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
   	... 51 more
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org