I JDBC ska din SQL-sats inte avslutas med semikolon.
Ändra
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "';";
till
String command = "SELECT distinct fname, lname, student_id FROM student"+
" where degree='"+ degree + "'";