@Override
    public void add(User userBean) {
        try {
            connection = getConnection();
            ptmt = connection.prepareStatement("INSERT INTO user(Name, Login, email, DateOfRegistration, password) "
                    + "VALUES(?,?,?,?,?);");
            ptmt.setString(1, userBean.getName());
            ptmt.setString(2, userBean.getLogin());
            ptmt.setString(3, userBean.getEmail());
            ptmt.setDate(4, (Date) userBean.getDateOfRegistration());
            ptmt.setString(5, userBean.getPassword());
            ptmt.executeUpdate();
        } catch (SQLException ex) {
            Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                if (ptmt != null) {
                    ptmt.close();
                }
                if (connection != null) {
                    connection.close();
                }
                if (resultSet != null) {
                    resultSet.close();
                }
            } catch (SQLException ex) {
                Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }