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 have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS SELECT queue_message_entity WHERE `insert_time` < '1970-01-01 08:00:55'' at 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 while setting parameters
### SQL: INSERT INTO queue_message_entity_bak AS SELECT queue_message_entity WHERE `insert_time` < ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS SELECT queue_message_entity WHERE `insert_time` < '1970-01-01 08:00:55'' at line 1
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS SELECT queue_message_entity WHERE `insert_time` < '1970-01-01 08:00:55'' at line 1
at 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.$Proxy120.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.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.$Proxy121.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.$Proxy123.insertQueueBackup(Unknown Source)
at com.lk.BackupCommandLineRunner.insertQueueBackup(BackupCommandLineRunner.java:61)
at com.lk.BackupCommandLineRunner.run(BackupCommandLineRunner.java:27)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)
... 6 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS SELECT queue_message_entity WHERE `insert_time` < '1970-01-01 08:00:55'' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.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)

其实是很简单的,  下面的语句中多了个as, 不应该的.

INSERT INTO queue_message_entity_bak AS SELECT queue_message_entity WHERE `insert_time` < ?

本来就是简单的sql 语法错误, 还以为是日期格式问题, 搞了几个小时, 也是郁闷了. 原因还是不够细心, 没注意到 BadSqlGrammarException 这个提示.

低级sql语法错误: BadSqlGrammarException的更多相关文章

  1. 愚蠢的sql语法错误(sum (xxx))

    sum和()之间打了一个空格,导致一致报sql语法错误,看了半天不知道怎么回事orz

  2. 【Mac系统】之Mysql数据库遇到修改数字密码的问题(SQL语法错误:ERROR 1064 (42000),密码策略等问题:ERROR 1819 (HY000))

    安装完Mysql也进行了第一次初始化密码以及修改密码规则(请参考文章),但是我想后续再改密码,出现了下面几个问题: #SQL语句错误问题 ERROR 1064 (42000): You have an ...

  3. spring + myBatis 常见错误:SQL语法错误

    在程序运行时,有时候会出现如下错误: 这个错误通常是你的sqlmapper.xml中sql语句语法有错误.所以请仔细查看你sql语句是否正确,比如{#id}这样写就会报上述错误,其实应该#{id}这样 ...

  4. Java调用存储过程出现Bug,sql语法错误

    因为SQL Server运行没有正常,检查了传入参数的值,发现问题,然后传入默认参数,解决了问题.

  5. SQL语句:语法错误(操作符丢失)在查询表达式中

    所谓操作符丢失,应该是你在拼接SQL语句是少了关键词或者分隔符,导致系统无法识别SQL语句.建议:1.监控SQL语句,看看哪里出现问题:断点看下最后的sql到底是什么样子就知道了,另外你可以把这段sq ...

  6. SQL SERVER 重组含有特殊字符的索引时遇到“关键字 'with' 附近有语法错误.”

    案例描述 这是在索引重组过程中遇到的有意思的错误案例,搜索了一下也没有看到相关资料,估计我第一个碰到这类错误的人(It's just a joke).具体情况是YourSQLDba在做维护数据库索引时 ...

  7. SQL if exists database总是出现语法错误

    SQL if exists总是出现语法错误.望高手纠正._百度知道 http://zhidao.baidu.com/link?url=7VyzcX0V1A3lhBQ1emNt2sTk7QGDuijOq ...

  8. sql server 数据库 ' ' 附近有语法错误

    昨天做项目时候,遇到标题的问题,代码跟踪把sql 语句 复制出来在数据库执行不了, 然后重新写个一模一样的,然后在 赋值到代码中,还是同样的错误, 就是不知道哪里出现了错误,最后 把 sql 语句写成 ...

  9. SQL 2012 Always On 为 MSCRMSqlClrLogin SQL 登录名创建非对称密钥时报语法错误

    根据实施手册中的下图的SQL在为MSCRMSqlClrLogin 创建非对称秘钥时报语法错误,具体的错误在就path那,调了多次还是报错,索性就把SQL拆开执行. 先执行这条 SELECT * FRO ...

随机推荐

  1. virsh命令和虚拟机克隆

    virsh 命令 virsh list  //列出正在运行虚拟机 virsh list --all     //列出所有虚拟机 virsh  console sunhao-1  //进入名字为sunh ...

  2. cornerstone 使用-图标含义-分支-合并

    http://www.jianshu.com/p/7f5c019c528b http://www.cnblogs.com/fyongbetter/p/5404697.html

  3. linq的基本使用

    1.查询所有的偶数 , , , , , , , , , , , , }; var elist = from s in str == select s; foreach (int i in elist) ...

  4. FCC JS基础算法题(9):Mutations(比较字符串)

    题目描述: 如果数组第一个字符串元素包含了第二个字符串元素的所有字符,函数返回true.举例,["hello", "Hello"]应该返回true,因为在忽略大 ...

  5. Matlab_audiowrite_音频生成

    输出音频文件所需函数为 audiowrite .通过例程进行解释: % 生成时间序列 fs = 5000; % [Hz] 信号采样频率 T = 1; % [s] 信号长度 x = 0:1/fs:T; ...

  6. echarts双y轴折线图柱状图混合实时更新图

    先看下效果,自己用ps做了张gif图,发现很好玩啊..不喜勿喷 自己下载个echarts.min.js 直接上代码: <!DOCTYPE html><html><head ...

  7. Centos6.5修改镜像为国内的阿里云源

    第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back ...

  8. 解决eclipse高版本JDK编译的项目到低版本JDK服务器上不能运行的问题

    错误提示信息:Unsupported major.minor version 52.0,意思是说,当前jdk的版本不支持更高版本jdk编译出来的class文件. 我的编译环境,eclipse使用的是j ...

  9. hdu 2095 find your present (2) 位运算

    题意:找出现次数为奇数的数 xor运算 #include <cstdio> #include <iostream> #include <algorithm> usi ...

  10. Centos7 安装nginx1.14

    一丶官网 http://nginx.org/en/download.html 至于安装那个版本首先要看清楚版本代表什么意思 Nginx官网提供了三个类型的版本Mainline version:Main ...