@Override
    public void setType(int id, String type) {
        try {
            connection = getConnection();
            ptmt = connection.prepareStatement("UPDATE User_types SET type=? WHERE id_user=?;");
            ptmt.setInt(2, id);
            ptmt.setString(1, type);
            ptmt.executeUpdate();
        } catch (SQLException ex) {
            Logger.getLogger(UserTypesDAO.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(UserTypesDAO.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    }