Dans JDBC, votre instruction SQL ne doit pas se terminer par un point-virgule.
Modifier
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "';";
à
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "'";