galera to passando a seguinte query pro meu metodo:
public final String UPDATE = "UPDATE Cliente SET nome='?', endereco='?', telefone='?', data_nasc='?' WHERE idCliente='?';";
public void update(String nome, String endereco, String telefone, String data, int id){
Connection connection = new ConnectionFactory().getConnection();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
try {
java.util.Date d = sdf.parse(data);
PreparedStatement prepStm = connection.prepareStatement(UPDATE);
prepStm.setString(1, nome); // AQUI <<<<
prepStm.setString(2, endereco);
prepStm.setString(3, telefone);
prepStm.setDate(4, new Date(d.getTime()));
prepStm.setInt(5, id);
prepStm.execute();
}
catch(SQLException sqle){
sqle.printStackTrace();
}
catch(ParseException pe){
pe.printStackTrace();
}
}
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3288)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3272)
at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:4108)
