getUsersStatement.setString(1, name.toLowerCase(Locale.US));
rsUsers = getUsersStatement.executeQuery();
// For case-insensitive matching, the first matching user will be returned.
User user = null;
while ( rsUsers.next() ) {
User rowUser = readUserFromResultSet(rsUsers);
String actualName = rowUser.getUserName();
// Check case before we assume it's the right one.
if ( ignoreCase || actualName.equals(name) ) {
user = rowUser;
break;