In JDBC la tua istruzione SQL non dovrebbe essere terminata da punto e virgola.
Cambia
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "';";
a
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "'";