Now you're going to handle exceptions in case there are problems with your SQL statements, then display confirmation of successful registration and close the POST response (see Listing 6).
Both statements can use the PreparedStatement syntax (see Resources) of "? "for a parameter, in which case the username will be set for every parameter.