(Msg. 1) Posted: Wed Aug 13, 2008 1:51 pm
Post subject: operation similar SQL's JOIN in LDAP? Archived from groups: microsoft>public>win2000>active_directory (more info?)
I have two base DN's in an LDAP database. One of them contains an
attribute called 'members' of type DN. I'd like to be able to take
each of the values for 'members' and do a query with that, too.
With SQL, you'd do this by doing a JOIN. eg.
SELECT p.*
FROM people p
JOIN mailing_list ml
ON ml.person_id = p.person_id
WHERE ml.mail_id = whatever
(Msg. 2) Posted: Wed Aug 13, 2008 6:24 pm
Post subject: Re: operation similar SQL's JOIN in LDAP? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Aug 13, 7:43 pm, "Richard Mueller [MVP]" <rlmueller-
nos... DeleteThis @ameritech.nospam.net> wrote:
> "yawnmoth" <terra1... DeleteThis @yahoo.com> wrote in message
>
> news:f276579d-860d-4763-894f-f57b4db0c3a6@z72g2000hsb.googlegroups.com...
>
> >I have two base DN's in an LDAP database. One of them contains an
> > attribute called 'members' of type DN. I'd like to be able to take
> > each of the values for 'members' and do a query with that, too.
>
> > With SQL, you'd do this by doing a JOIN. eg.
>
> > SELECT p.*
> > FROM people p
> > JOIN mailing_list ml
> > ON ml.person_id = p.person_id
> > WHERE ml.mail_id = whatever
>
> > Or something like that.
>
> > Is there something similar I can do in LDAP?
>
> In my area (ADSI and ADO), both LDAP and SQL syntax queries are supported,
> but SQL syntax is converted to LDAP syntax under the covers, and not all SQL
> features are supported. JOIN's are not supported. I suspect this would be
> true of any LDAP database.
>
> Is a base DN a namespace? Also, many JOINs can be replaced by a sub query,
> which is essentially nested queries. Maybe you can do something similar.
> More detail about what you are trying to accomplish might help.
OU=Distribution Lists,DC=subdomain,DC=domain,DC=tld contains a bunch
of mailing lists. There's a member field that, itself, contains
entries like this:
I could take each of those entries and do a separate query for each of
them, but I'd prefer not to - I'd prefer it if I could do everything
in one step. Kinda like how JOINs do make it so you can do what would
otherwise be a bunch of separate queries in a single query
(Msg. 3) Posted: Wed Aug 13, 2008 7:43 pm
Post subject: Re: operation similar SQL's JOIN in LDAP? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
"yawnmoth" <terra1024.RemoveThis@yahoo.com> wrote in message
news:f276579d-860d-4763-894f-f57b4db0c3a6@z72g2000hsb.googlegroups.com...
>I have two base DN's in an LDAP database. One of them contains an
> attribute called 'members' of type DN. I'd like to be able to take
> each of the values for 'members' and do a query with that, too.
>
> With SQL, you'd do this by doing a JOIN. eg.
>
> SELECT p.*
> FROM people p
> JOIN mailing_list ml
> ON ml.person_id = p.person_id
> WHERE ml.mail_id = whatever
>
> Or something like that.
>
> Is there something similar I can do in LDAP?
In my area (ADSI and ADO), both LDAP and SQL syntax queries are supported,
but SQL syntax is converted to LDAP syntax under the covers, and not all SQL
features are supported. JOIN's are not supported. I suspect this would be
true of any LDAP database.
Is a base DN a namespace? Also, many JOINs can be replaced by a sub query,
which is essentially nested queries. Maybe you can do something similar.
More detail about what you are trying to accomplish might help.
(Msg. 4) Posted: Wed Aug 13, 2008 8:14 pm
Post subject: Re: operation similar SQL's JOIN in LDAP? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
So you want to dump all the people who are members of a certain group?
--
Thanks,
Brian Desmond
Windows Server MVP - Directory Services
"yawnmoth" <terra1024.RemoveThis@yahoo.com> wrote in message
news:f276579d-860d-4763-894f-f57b4db0c3a6@z72g2000hsb.googlegroups.com...
>I have two base DN's in an LDAP database. One of them contains an
> attribute called 'members' of type DN. I'd like to be able to take
> each of the values for 'members' and do a query with that, too.
>
> With SQL, you'd do this by doing a JOIN. eg.
>
> SELECT p.*
> FROM people p
> JOIN mailing_list ml
> ON ml.person_id = p.person_id
> WHERE ml.mail_id = whatever
>
> Or something like that.
>
> Is there something similar I can do in LDAP?
(Msg. 5) Posted: Wed Aug 13, 2008 10:27 pm
Post subject: Re: operation similar SQL's JOIN in LDAP? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
yawnmoth wrote:
OU=Distribution Lists,DC=subdomain,DC=domain,DC=tld contains a bunch
of mailing lists. There's a member field that, itself, contains
entries like this:
I could take each of those entries and do a separate query for each of
them, but I'd prefer not to - I'd prefer it if I could do everything
in one step. Kinda like how JOINs do make it so you can do what would
otherwise be a bunch of separate queries in a single query
-------
In the OU "ou=Distribution Lists" are group objects. Each group object has a
member attribute, which is a collection of DN's of members. Given each
member DN, I don't see what query is needed. You can either list all member
DN's, or bind to the corresponding member object with the DN and retrieve
the values of other attributes of the member. If the aim is to retrieve
other attributes of the members, the best method I can think of is to bind.
Any kind of query/search would be slower. In fact, ADSI provides the Members
method of the IADsGroup object, which is a collection of member objects. In
VBScript:
=========
Set objOU = GetObject("LDAP://OU=Distribution
Lists,DC=subdomain,DC=domain,DC=tld")
objOU.Filter = Array("group")
For Each objGroup In objOU
Wscript.Echo "Group: " & objGroup.distinguishedName
For Each objMember In objGroup.Members
Wscript.Echo " " & objMember.distinguishedName & " (" &
objMember.Class & ")"
Next
Next
=======
I added the "Class" of the member, just to show you can document any
attributes of the members you like. Just remember that members can be users,
contacts, groups, or even computers (in general). You could document the
sAMAccountName (pre-Windows 2000 logon name) for example, but contact
objects do not have this attribute.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum