Please edit your post to
UseCodeTags, then indicate to us which line is line 21, and also tell us which object is null.
What are the "toString()" calls supposed to accomplish for username and password?
Strings are not compared using the "==" operator, but using the "equals" method.
The DB query won't work because you're using the
string "username" where
you should be passing in the value of the "username" variable. Read up on PreparedStatement on how to do that.