JDBC UPDATE With preparedStatement causing java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2) [duplicate]

核能气质少年 提交于 2019-12-02 04:29:49

This ps.setInt(3, 1000); must be ps.setInt(2, 1000); because you only have to placeholder.

Is it mandatory for to put placeholder('?') for each column of the table?

The placeholder is for a parameter not for a column!

you have not more than two question marks(placeholder) in your statement. As a result of this, this must fail:

ps.setInt(3, 1000);

change it to

ps.setInt(2, 1000);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!