Spring入门程序之异常总结

1.数据库查询异常:

org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [update account set money=? where id=?Parameter index out of range (2 > number of parameters, which is 1).; nested exception is java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).

出问题语句:

jdbcTemplate.update("update account set money=? where id=?",account.getMoney(),account.getId());

由此发现是两个占位符不同,其中一个占位符使用了中文符号。

注意:编写代码时最好设置下"中文下使用英文标点"

猜你喜欢

转载自blog.csdn.net/Oceanside_yh/article/details/82776548