低级sql语法错误: BadSqlGrammarException
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的更多相关文章
- 愚蠢的sql语法错误(sum (xxx))
sum和()之间打了一个空格,导致一致报sql语法错误,看了半天不知道怎么回事orz
- 【Mac系统】之Mysql数据库遇到修改数字密码的问题(SQL语法错误:ERROR 1064 (42000),密码策略等问题:ERROR 1819 (HY000))
安装完Mysql也进行了第一次初始化密码以及修改密码规则(请参考文章),但是我想后续再改密码,出现了下面几个问题: #SQL语句错误问题 ERROR 1064 (42000): You have an ...
- spring + myBatis 常见错误:SQL语法错误
在程序运行时,有时候会出现如下错误: 这个错误通常是你的sqlmapper.xml中sql语句语法有错误.所以请仔细查看你sql语句是否正确,比如{#id}这样写就会报上述错误,其实应该#{id}这样 ...
- Java调用存储过程出现Bug,sql语法错误
因为SQL Server运行没有正常,检查了传入参数的值,发现问题,然后传入默认参数,解决了问题.
- SQL语句:语法错误(操作符丢失)在查询表达式中
所谓操作符丢失,应该是你在拼接SQL语句是少了关键词或者分隔符,导致系统无法识别SQL语句.建议:1.监控SQL语句,看看哪里出现问题:断点看下最后的sql到底是什么样子就知道了,另外你可以把这段sq ...
- SQL SERVER 重组含有特殊字符的索引时遇到“关键字 'with' 附近有语法错误.”
案例描述 这是在索引重组过程中遇到的有意思的错误案例,搜索了一下也没有看到相关资料,估计我第一个碰到这类错误的人(It's just a joke).具体情况是YourSQLDba在做维护数据库索引时 ...
- SQL if exists database总是出现语法错误
SQL if exists总是出现语法错误.望高手纠正._百度知道 http://zhidao.baidu.com/link?url=7VyzcX0V1A3lhBQ1emNt2sTk7QGDuijOq ...
- sql server 数据库 ' ' 附近有语法错误
昨天做项目时候,遇到标题的问题,代码跟踪把sql 语句 复制出来在数据库执行不了, 然后重新写个一模一样的,然后在 赋值到代码中,还是同样的错误, 就是不知道哪里出现了错误,最后 把 sql 语句写成 ...
- SQL 2012 Always On 为 MSCRMSqlClrLogin SQL 登录名创建非对称密钥时报语法错误
根据实施手册中的下图的SQL在为MSCRMSqlClrLogin 创建非对称秘钥时报语法错误,具体的错误在就path那,调了多次还是报错,索性就把SQL拆开执行. 先执行这条 SELECT * FRO ...
随机推荐
- JavaScript实现本地图片上传前进行裁剪预览
本项目支持IE8+,测试环境IE8,IE9,IE10,IE11,Chrome,FireFox测试通过 另:本项目并不支持Vue,React等,也不建议,引入JQuery和Vue.React本身提倡的开 ...
- Python基础03_pycharm
pycharm的安装还是很简单的,一路next. 看起来Jet Brains 家的产品长相都差不多啊. 主要是create new project时,路径和解释器的选择,我电脑上有2.7和3.6 所以 ...
- MySQL:数据操作
数据操作 一.插入数据 1.所有字段插入数据 语法: insert into 数据表名(字段名) values(插入的数据);(标准)insert into 数据表名values(插入的数据); 实例 ...
- Linux性能监控分析命令(一)—vmstat命令详解
一.vmstat介绍 语法格式: vmstat [-V] [-n] [-S unit] [delay [count]] -V prints version. -n causes the headers ...
- css 长用点
功能 : font-size: 0; 去除图片之间空白空隙
- mac搭配Nginx服务器常见问题
推流服务器主要是使用了开源的nginx和rtmp模块,网上也有很多资料,不过对有些可能出现的问题没有很好的总结. 安装brew 使用Mac进行开发很久的老司机应该对这个工具很熟悉了.brew是一个第三 ...
- api管理平台
安装和介绍 安装要求:(centos安装环境) nodejs(7.6+) mongodb(2.6|+) 安装get和编译的工具 yum -y install wget make gcc gcc-c++ ...
- XML二
XML的语法要求: 1,XML文档必须有一个顶层元素,即文档元素,所有其他元素必须嵌入在文档元素中. 2,元素嵌套要正确,即如果一个元素在另一个元素中开始,那么必须在同一个元素中结束. 3,每个元素必 ...
- POJ2376 Cleaning Shifts
题意 POJ2376 Cleaning Shifts 0x50「动态规划」例题 http://bailian.openjudge.cn/practice/2376 总时间限制: 1000ms 内存限制 ...
- Redis使用规范
突出强调部分 [强制]key名不要包含特殊字符,如空格.换行.单双引号以及其他转义字符 [强制]拒绝bigkey(防止网卡流量.慢查询) [强制]控制key的生命周期,redis不是垃圾桶 [强制]技 ...