st.executeQuery is for select statements. st.executeUpdate is for insert/update/delete statements.
The error message does hint at this with "Can not issue data manipulation statements with executeQuery()." It just doesn't tell you the fix. As you learn about
JDBC, look into PreparedStatements. They are easier to use when setting parameters. And safer too - you don't have to worry about evil users attacking your database with SQL Injection.