I JDBC bør din SQL-sætning ikke afsluttes med semikolon.
Skift
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "';";
til
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "'";