En JDBC, su instrucción SQL no debe terminar con punto y coma.
Cambiar
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 + "'";