java.sql.SQLException

Parameter index out of range (3 > number of parameters, which is 2).

Samebug tips1

MySQL doesn't support some types of characters (such as emojis) with the utf8 encoding. You need to be on MySQL 5.5+ and force utf8mb4 (everywhere, client and server). You can do this sending the query "SET NAMES utf8mb4". Check this https://goo.gl/3E2qzg

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web6449

  • Parameter index out of range (3 > number of parameters, which is 2).
  • Parameter index out of range (3 > number of parameters, which is 2).
  • via oracle.com by Unknown author, 1 year ago
    Parameter index out of range (3 > number of parameters, which is 2).
  • Stack trace

    • java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:937) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:872) at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3367) at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3352) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:4078) at demojdbc.MysqlCon.main(MysqlCon.java:21)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    2 times, 1 month ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    4 times, 2 weeks ago
    5 times, 2 weeks ago
    148 more bugmates