通过Spring的jdbcTemplate调用Mysql的存储过程,出现下面的问题(以前也使用过,并没有出现下面的问题,折腾大半天,郁闷):

开始报下面的错误:

[INFO ]2014-07-01 10:49:15,297 MESSAGE : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]

[INFO ]2014-07-01 10:49:15,413 MESSAGE : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]

没有更多的错误信息,数据库中也没有反应。然后,通过加入try()catch{}后,可以打印出主要的错误信息如下:

org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.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 '`res`)' at line 1

根据错误提示,应该是SQL语法错误,但是在Navicat里面执行,没有问题,我就郁闷了。

创建存储过程语句是,是Navicat工具按步骤创建的:

CREATE DEFINER=`root`@`localhost` PROCEDURE `huabei_dhqr_id`(OUT 'res' varchar(32))

后来将参数中的引号去掉,改为:

CREATE DEFINER=`root`@`localhost` PROCEDURE `huabei_dhqr_id`(OUT res varchar(32))

可执行成功!

转载于:https://blog.51cto.com/quietboy/1432984

org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar相关推荐

  1. Resolved [org.springframework.jdbc.BadSqlGrammarException

    写订单的时候表名用的order 结果一直出现 check the manual that corresponds to your MySQL server version for the right ...

  2. org.springframework.jdbc.BadSqlGrammarException: Error updating database

  3. 使用jdbc:nested exception is java.sql.SQLException: No value specified for parameter或bad SQL grammar

    bad SQL grammar:错误出现原因有下面几种: 下面这个是正确代码: 1.可能是数据库连接时,数据库名写错 2.数据库的表名写错 3.定义的sql里面的属性和values里面的属性个数不一致 ...

  4. mybatis错误:bad SQL grammar [];error occurred while setting parameters;involve defaultParameterMap处理

    业务描述:由于处理数据量庞大,多表进行拆分,每次任务新建一个表.在往新建表(表名要传参)插入数据时,提示错误: Error updating database.  Cause: java.sql.SQ ...

  5. Struts+Spring+Hibernate处理Lob(Blob,Clob)--sessionFactory中注入 org.springframework.jdbc.support.lob.Def

    [转载]org.springframework.jdbc.support.lob. 转载▼ 标签: 转载 分类: spring 原文地址:org.springframework.jdbc.suppor ...

  6. org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested

    org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested ...

  7. org.springframework.jdbc.UncategorizedSIncorrect string value: ‘\xE5\xB0\x8F\xE8\x83\xA1‘ for column

    报错如下: org.springframework.jdbc.UncategorizedSQLException: ### Error updating database. Cause: java.s ...

  8. IDEA连接数据库时报错org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

    IDEA连接数据库的记录 各种看不懂的错 org.springframework.test.context.support.DefaultTestContextBootstrapper getTest ...

  9. Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:

    一. 异常信息:Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: E ...

最新文章

  1. Xshell发送命令到全部会话
  2. JAVA中一维数组的作用,JAVA中一维数组和二维数组的定义
  3. salt常用命令(一)
  4. 喜大普奔,网易猪肉要到你碗里来了!
  5. “电脑人才”是怎么炼成的
  6. 腐蚀rust服务器命令_【使用 Rust 写 Parser】2. 解析Redis协议
  7. 知云文献翻译打不开_文献翻译工具-知云文献翻译
  8. Win11如何开启聚焦功能?Win11开启聚焦功能的方法
  9. windows 端口占用
  10. c语言冒泡排序法代码
  11. Canon imageRUNNER 2525i打印机驱动通过IP地址进行安装
  12. JavaScript(BOM、窗口事件和计时器)
  13. 计算机默认网络密码是多少,中国电信的默认服务密码是什么
  14. 相机与镜头的基本概念
  15. Parse error in application web.xml file at jndi:/localhost/ipws/WEB-INF/web.xml
  16. matlab中scr,基于matlab生成的scr文件,实现autocad曲线绘制,代码问题
  17. 使用FlatBuffers序列化数据
  18. 《Rethinking Video Anomaly Detection - A Continual Learning Approach》异常检测 WACV-2022
  19. js 判断是否为空对象,或者空数组
  20. DDS (Data Distribution Service) 数据分发服务-规范中文翻译-1

热门文章

  1. splitcontainer如何设置两边一样打_墙洞加筋如何计算?
  2. vue vuex 挂载_Vue $mount()手动挂载
  3. 在plsql里面怎么去掉空行_盐渍樱花怎么做?详细做法告诉您,一年都不会坏,学会再也不用买...
  4. diy高性能存储服务器,diy存储服务器
  5. 微信小程序 实现复制到剪贴版功能
  6. 一个简单的slider滑块组件
  7. #读书笔记 Android-Activity启动模式
  8. Linux的su命令,sudo命令和限制root远程登录
  9. 预计2020年传感器需求超一万亿个
  10. 创新类编辑推荐:Sequence iBPMS平台