在JDBC中,您的SQL语句不应以分号终止。
更改
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 + "'";

在JDBC中,您的SQL语句不应以分号终止。
更改
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 + "'";