FAQ(41):Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:

magic-api的鉴权机制配置 (附实战代码) 引入magic-api及相关数据库驱动依赖 配置yml文件和编辑器JS文件 实现登录鉴权逻辑,包括用户验证和Token处理 接口鉴权拦截器设计,确保接口访问安全性 文章提供了完整的代码示例,帮助开发者快速集成magic-api框架并实现权限控制功能。 阅读详情
欢迎扫二维码关注公众号,获取技术干货

2018/1/3

spring对Mybatis整合,

看Log:

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 'b.providerId=1,b.isPayment=2
		    and b.providerId=p.id' at line 3
### The error may exist in com/smbms/dao/BillMapper.xml
### The error may involve com.smbms.dao.BillMapper.billShowByCondition-Inline
### The error occurred while setting parameters
### SQL: select b.billCode,b.productName,p.proName,b.totalPrice,b.isPayment,b.creationDate     from smbms_bill b,smbms_provider p     where b.produceName=?,b.providerId=?,b.isPayment=?       and b.providerId=p.id
### 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 'b.providerId=1,b.isPayment=2
		    and b.providerId=p.id' at line 3
; 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 'b.providerId=1,b.isPayment=2
		    and b.providerId=p.id' at line 3
	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.$Proxy7.selectList(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
	at com.sun.proxy.$Proxy8.billShowByCondition(Unknown Source)
	at com.smbms.service.BillServiceImpl.findBillsWithConditionsByThressConditions(BillServiceImpl.java:19)
	at com.smbms.service.BillServiceImplTest.test(BillServiceImplTest.java:32)
	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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	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.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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 'b.providerId=1,b.isPayment=2
		    and b.providerId=p.id' at line 3
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	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)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2487)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
	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.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
	at com.sun.proxy.$Proxy10.execute(Unknown Source)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
	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)
	... 31 more


解释:
我的sql语句写错了!!
使用where多条件刷选时,条件之间要用and分割。

 

 

 

 

 

 

Centos7 yum 报错「Errno 256」No more mirrors to try 解决方法 首先该问题的出现是由于网络的震荡导致,这是重点。(1)将源更换成阿里云的官方源,步骤参考如上(2)同时将zabbix的官方源更换成阿里云里面的zabbix镜像源,因为zabbix官方源根本网络不通,因为国家防火墙的拦截,导致网络不通。这是阿里源的zabbix镜像地址: https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/修改系统中早期生成的zabbix.repo文件,如下:主要是把baseurl替换成阿里云的zabbix镜像地址即可。 阅读详情

相关推荐

ESP32 STA AP模式下,设备连接 ESP的AP 后无法上网,无法访问域名上网(或者Failed to enable NAPT)

ESP32 STA AP模式下,设备连接 ESP的AP 后无法上网,无法访问域名上网(或者Failed to enable NAPT)1.可能是ESP STA模式未成功连接到路由器,确保 STA 成功连接到外部网络。2.检查 STA 和 AP 的网络配置是否正确,避免子网冲突。3.ESP32的NAPT功能未正确启用,确保 menuconfig 中已启用 IP_NAPT。4.DNS服务器未正确配置。

qq_34885669的博客 1539

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'hx_user' in 'field list'

四季轮换叶,一路招摇胜 1万+

6G网络的关键技术、应用前景与挑战并存的科技征途

移动通信技术正以前所未有的速度迭代更新,而6G技术的研发进程渐渐成为了当前科技领域的热点。全球各国已纷纷将目光投向了充满想象的6G时代。本文将探讨全球6G技术研发的最新进展,以及6G技术的核心创新与潜在应用。

fiberroad的博客 2424

解决 ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:

解决 ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column ‘root’ in ‘where clause’ 最近在测试mybatis的**${}** 传参时的sql注入问题时,遇到了这个bug,记录一下,本人感到非常奇怪。 具体报错: Exception in thread “main” org.apache.ibatis.excepti

weixin_46202290的博客 1万+

sqoop抽取mysql的数据到hive表里面,字段内容被自动截取,导致字段不全的问题解决

今天央视重新转播NBA,写篇博客纪念一下这个重要的日子,湖人的表现就呵呵了!!!! 强行转到博客的主题来 mysql的字段属性:该字段能存下的值比如:“山东” `province` varchar(3) NOT NULL COMMENT '省份' 用sqoop sqoop import --connect "jdbc:mysql://xxxxxx:3306/xxxxxx?tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull..

放肆桀骜 963

Google antigravity 不支持你所在地区?手把手教你把账号改成支持地区

Google antigravity功能火爆,但国内老账号根本用不了🤬本文分享几种有效的账号国家地区切换方法,最快几分钟就能让antigravity直接亮起🔥

XiaoqiangClub的博客 2万+

### Error querying database. Cause com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server

cxywangshun的博客 4148

【原理图PCB专题】Allegro模块化移动器件报...has the LOCKED property怎么解锁?

正常来说做好一个模块化,如果不需要再动,最好还是lock,防止不明白的工程师异动导致问题。如果复用布局设计时,因为有些器件和拓扑并不完全一致,那需要调整部分器件,被锁之后只能全选,无法修改。所以解开锁定后,就能正常编辑了。

一点硬件 2391

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException最全解决

org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manua...

混子 2万+

[QMT和ptrade量化交易小白入门]-121、如何用K-means聚类,每月自动筛选高流动性ETF

本专栏主要是介绍QMT和ptrade的基础用法,常见函数,写策略的方法,也会分享一些量化交易的思路,大概会写200篇左右。QMT的相关资料较少,在使用过程中不断的摸索,遇到了一些问题,记录下来和大家一起沟通,共同进步。

木头大左的博客 828

基于STM32设计自动输液监测系统(241)

该系统集成了液位传感模块、光电传感器、电机模块、按键模块和OLED显示屏等多个功能模块,以实现全面的输液过程监控和控制。液位传感模块能够实时监测输液瓶中的液位,当液位到达限定值时,系统会自动控制步进电机夹紧输液管,并发出报警提醒,确保输液过程不会因液位过低而中断。

1341

解决MySQL报错Error querying database.Cause com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException.

项目测试环节,jdbc连接过程where子句出现报错问题收录解决。

2393

从零实现深度学习框架【实现自己的PyTorch(已完结)】

本着“凡我不能创造的,我就不能理解”的思想,此系列文章会基于纯Python以及NumPy从零创建自己的深度学习框架,该框架类似PyTorch能实现自动求导。

日积月累,天道酬勤 6862

mysql升级版本后正常执行的sql报错:Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

业务场景是这样的:本地测试接口时用的本地mysql数据库是低版本的5.1.55-community,没有问题。但是上到测试环境后,执行同样的接口请求,却报了sql异常。测试环境的mysql库是1.8高版本的,感觉问题出在版本上。加上本地测试没问题,可以肯定是数据库的问题。剩下的就是排查数据库哪方面的问题了。 报错信息如下; Error querying database. Cause: com....

万米高空的博客 4529

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException

1.问题描述: ### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 170,369 mi

我爱编程持之以恒 4万+

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

简单解决 Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

简单解决 Error updating 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 '表名

孤er尽悲欢绝的博客 8498

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.Communicatio

一、在MyBatis连接数据库时控制台报错: org.apache.ibatis.exceptions.PersistenceException:### Error querying database. Cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 二、解决方法: 在mysql中的连接字符串url中加入useSSL=false即可。 出错的源代码为: ...

m0_50958694的博客 4947

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:

** 报错结果 ** org.apache.ibatis.exceptions.PersistenceException: ### 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 vers

穹妹纸的博客 3509

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manu...

qq_40181435的博客 3652

动态sql以及Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

1.数据库表: CREATE TABLE blog( id VARCHAR(50) NOT NULL COMMENT '博客id', title VARCHAR(100) NOT NULL COMMENT '博客标题', author VARCHAR(30) NOT NULL COMMENT '博客作者', create_time DATETIME NOT NULL COMMENT '创建时间', views INT(30) NOT NULL COMMENT '浏览量' ) ENGINE=INNODB D

syq1791899128的博客 3801

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unkn

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'mybatis'

qq_55977139的博客 2231

事务超时导致,com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client

由于一定定时任务导致出现的异常信息(部分): ###Errorqueryingdatabase.Cause:com.mysql.jdbc.exceptions.MySQLTimeoutException:Statementcancelledduetotimeoutorclientrequest 原因是由于执行业务超出了配置的事务超时时间 由于在代码中配置了超时...

u011186019的专栏 9063

解决Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communica

因为教程老师不同,所以在用Spring整合MyBatis时,运行一直出现连接Mysql错误。

stevence112的博客 2134

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException报错解决方法

今天学习Mybatis时,碰到com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException,详细错误如下

名字被人抢注了 1万+

Mybatis报错Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException的解决

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communicat mybatis程序报错如下: org.apache.ibatis.exceptions.PersistenceException: Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

weixin_45898928的博客 2290

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL synt

这种错误一般都是sql语句编写错误导致了,可以把sql放到数据库里单独执行下看下能不能执行。我这个错误是因为我把 “DATE”写成了“DATA”导致的。

q1042644419的博客 2198
上一篇: FAQ(40):org.springframework.jdbc.BadSqlGrammarException: ### Error updating database. Cause: com.m
下一篇: FAQ(42):org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bill
后台技术汇
博客等级 码龄11年 670粉丝 531原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

后台技术汇

对你的帮助,是对我的最好鼓励。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值