BTW. I know virtually nothing about Java, but from perusing the java documentation, it appears that you may not want to use the apostrophes (string/date delimiters) in your SQL in a prepared statement. And, if that's the case, you might need to concatenate the wildcard character(s) to the text in the .setstring method call.
ps.setString(1, "%" + firstname + "%");