使用jdbcTemplate.queryForObject()报错

 

org.springframework.jdbc.BadSqlGrammarException:StatementCallback; bad SQL grammar [select dname from dept where deptno=?];

 

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 '?' at line 1

 

原因

jdbcTemplate.queryForObject()缺参

解决

jdbcTemplate.queryForObject()加参,参数在最后

posted on 2022-08-18 23:55  Wyz1022  阅读(71)  评论(0编辑  收藏  举报