W JDBC instrukcja SQL nie powinna być zakończona średnikiem.
Zmień
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "';";
do
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "'";