i am trying to insert some data using preparedStatement stringbuffer.append("Insert into testuser(username,email,testname,testdate,"); stringbuffer.append("validityperiod,testid,percentage,message)"); stringbuffer.append("values(?,?,?,'"+s4+"','"+s4+"',?,?,?)");
With a prepared statement, you set the SQL string at the beginning when you create the statement. With a regular statement, you pass the SQL when you call an execute method. Since you are passing the SQL when you call executeUpdate(), Java thinks you have a regular statement and doesn't know what to do with the question marks.