@Override
    public void selectCourses(List<Integer> mainCourseList, List<Integer> additionalCourseList, int userId) throws SQLException {

        Connection connect = null;
        PreparedStatement statement = null;
        try {
            Class.forName(Params.bundle.getString("urlDriver"));
            connect = DriverManager.getConnection(Params.bundle.getString("urlDB"),
                    Params.bundle.getString("userDB"), Params.bundle.getString("passwordDB"));
            String getTeacherId = "select student.id from student " +
                    "where student.user_id = ?";

            statement = connect.prepareStatement(getTeacherId);
            statement.setInt(1, userId);

            ResultSet studentIdSet = statement.executeQuery();
            studentIdSet.next();

            int studentId = studentIdSet.getInt("student.id");

            String selectMarks = "insert into student (main_course_1_id, main_course_2_id, main_course_3_id, main_course_4_id," +
                    "add_course_1_id,add_course_2_id) values (?,?,?,?,?,?) where student.id=?";
            statement = connect.prepareStatement(selectMarks);
            int i = 0;
            for(; i < mainCourseList.size(); i++)
                statement.setInt(i + 1, mainCourseList.get(i));
            for(; i < additionalCourseList.size(); i++)
                statement.setInt(i + 1, additionalCourseList.get(i - mainCourseList.size()));
            statement.setInt(i, studentId);
            statement.executeUpdate();

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            if(connect != null)
                connect.close();
            if(statement != null)
                statement.close();
        }
    }