@Override
 public Student getStudentById(int studentId) {
   Student student = new Student();
   try {
     String query = "select * from UserDB.student where studentId=?";
     PreparedStatement preparedStatement = conn.prepareStatement(query);
     preparedStatement.setInt(1, studentId);
     ResultSet resultSet = preparedStatement.executeQuery();
     while (resultSet.next()) {
       student.setStudentId(resultSet.getInt("studentId"));
       student.setFirstName(resultSet.getString("firstName"));
       student.setLastName(resultSet.getString("LastName"));
       student.setCourse(resultSet.getString("course"));
       student.setYear(resultSet.getInt("year"));
     }
     resultSet.close();
     preparedStatement.close();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return student;
 }
 @Override
 public List<Student> getAllStudents() {
   List<Student> students = new ArrayList<Student>();
   try {
     Statement statement = conn.createStatement();
     ResultSet resultSet = statement.executeQuery("select * from UserDB.student");
     while (resultSet.next()) {
       Student student = new Student();
       student.setStudentId(resultSet.getInt("studentId"));
       student.setFirstName(resultSet.getString("firstName"));
       student.setLastName(resultSet.getString("lastName"));
       student.setCourse(resultSet.getString("course"));
       student.setYear(resultSet.getInt("year"));
       students.add(student);
     }
     resultSet.close();
     statement.close();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return students;
 }