At Org.springframework.boot.SpringApplication.callRunners (springapplication.java:760) at Org.springframework.boot.SpringApplication.afterRefresh (Springapplication.java:747) at Org.springframework.boot.SpringApplication.run (Springapplication.java:315) at Org.springframework.boot.SpringApplication.run (Springapplication.java:1162) at Org.springframework.boot.SpringApplication.run (Springapplication.java:1151) at Com.lk.ActivemqApplication.main (Activemqapplication.java:12) caused by:org.springframework.jdbc.BadSqlGrammarException: # # # Error querying database. Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:You has an error in your SQL syntax; Check the manual, corresponds to your MySQL server version forThe right syntax to use near ' as SELECT ' queue_message_entity WHERE ' insert_time ' < ' 1970-01-01 08:00:55 ' in line 1# # # The error may exist in COM/lk/loms/mq/service/dao/mapper/Historymsgmapper.java (best guess) # # # The error may involve Com.lk.loms.mq.service.dao.mapper.HistoryMsgMapper.insertQueueBackup-inline### the error occurred whilesetting parameters### Sql:insert into Queue_message_entity_bak as SELECT queue_message_entity WHERE ' insert_time '
<?# # # Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:You has an error in your SQL syntax; check the Manual that corresponds to your MySQL server version forThe right syntax to use near ' as SELECT ' queue_message_entity WHERE ' insert_time ' < ' 1970-01-01 08:00:55 ' in line 1; bad SQL Grammar []; nested exception is Com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:You has an error In your SQL syntax; Check the manual, corresponds to your MySQL server version forThe right syntax to use near ' as SELECT ' queue_message_entity WHERE ' insert_time ' < ' 1970-01-01 08:00:55 ' in line 1At Org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate ( Sqlerrorcodesqlexceptiontranslator.java:231) at Org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate ( Abstractfallbacksqlexceptiontranslator.java:73) at Org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible ( Mybatisexceptiontranslator.java:73) at Org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke (Sqlsessiontemplate.java:446) at Com.sun.proxy. $Proxy 120.selectOne (Unknown Source) at Org.mybatis.spring.SqlSessionTemplate.selectOne (sqlse Ssiontemplate.java:166) at Org.apache.ibatis.binding.MapperMethod.execute (Mappermethod.java:83) at Org.apache.ibatis.binding.MapperProxy.invoke (Mapperproxy.java:59) at Com.sun.proxy. $Proxy 121.insertQueueBackup (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:333) at Org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint ( Reflectivemethodinvocation.java:190) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 157) 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.JdkDynamicAopProxy.invoke (Jdkdynamicaopproxy.java:213) at Com.sun.proxy. $Proxy 123.insertQueueBackup (Unknown Source) at Com.lk.BackupCommandLineRunner.insertQueueBac Kup (Backupcommandlinerunner.java:61) at Com.lk.BackupCommandLineRunner.run (Backupcommandlinerunner.java:27) at Org.springframework.boot.SpringApplication.callRunner (Springapplication.java:776) ... 6Common frames omittedcaused By:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:You has an error in your SQL syntax; Check the manual, corresponds to your MySQL server version forThe right syntax to use near ' as SELECT ' queue_message_entity WHERE ' insert_time ' < ' 1970-01-01 08:00:55 ' in line 1At Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at sun.reflect.NativeConstructorAcces Sorimpl.newinstance (Nativeconstructoraccessorimpl.java:62) at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (Delegatingconstructoraccessorimpl.java:45) at Java.lang.reflect.Constructor.newInstance (Constructor.java:423) at Com.mysql.jdbc.Util.handleNewInstance (Util.java:425) at Com.mysql.jdbc.Util.getInstance (Util.java:408) at Com.mysql.jdbc.SQLError.createSQLException (Sqlerror.java:943) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:3973) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (Mysqlio.java:3909)
In fact, it is very simple, the following statement is more than an as, should not.
INSERT into Queue_message_entity_bak as SELECT queue_message_entity WHERE ' Insert_time ' <?
Originally is simple SQL syntax error, also thought is the date format problem, engaged for a few hours, is also depressed. The reason is still not careful enough, did not notice badsqlgrammarexception this hint.
Low-level SQL syntax error: badsqlgrammarexception