469,601 Members | 2,308 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

SQL Server 2000 & Active Directory: Problems querying

Hello --

I'm trying to get SQL Server 2000 on a Windows 2000 Server to be able
to query an Active Directory. We've got two domain servers one Win2000
and one Win2003. However, I'm having problems:

I've run the following query to setup the linked server:

sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDSOObject', 'adsdatasource'

Using Enterprise Manager I've changed the login details for the ADSI
linked server to:

Be made using the following security context:
Username: MyDomain\Administrator
Password: ****

I've then tried to run the following query in Query Analyzer:

SELECT * FROM
OpenQuery(
ADSI,
'<LDAP://CN=Users,DC=MyDomain,DC=com>;(&(objectCategory=Per son)(objectClass=User));name,adspath'
)

But get the following error message:
Could not execute query against OLE DB provider 'ADSDSOObject'.

Does anyone have any ideas on what this message means or how to get
this working?

Thanks

--
James Allan
james [at] allan-home.co.uk
Jul 20 '05 #1
2 14970
"James Allan" <ja***@allan-home.co.uk> wrote in message
news:2f*************************@posting.google.co m...
Hello --

I'm trying to get SQL Server 2000 on a Windows 2000 Server to be able
to query an Active Directory. We've got two domain servers one Win2000
and one Win2003. However, I'm having problems:

I've run the following query to setup the linked server:

sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDSOObject', 'adsdatasource'

Using Enterprise Manager I've changed the login details for the ADSI
linked server to:

Be made using the following security context:
Username: MyDomain\Administrator
Password: ****

I've then tried to run the following query in Query Analyzer:

SELECT * FROM
OpenQuery(
ADSI,
'<LDAP://CN=Users,DC=MyDomain,DC=com>;(&(objectCategory=Per son)(objectClass=
User));name,adspath' )

But get the following error message:
Could not execute query against OLE DB provider 'ADSDSOObject'.

Does anyone have any ideas on what this message means or how to get
this working?

Thanks

--
James Allan
james [at] allan-home.co.uk


From searching on Google, it seems some people have managed to get this to
work. However, this posting from an MS engineer seems to indicate that the
provider isn't supported in SQL Server:

http://groups.google.com/groups?hl=e...40cpmsftngxa06

Simon

Jul 20 '05 #2
You might try changing your LDAP query just a little, the linked server
syntax is fine.

SELECT [Name],SN[Last Name]
FROM OPENQUERY( ADSI,
'SELECT Name,SN FROM ''LDAP://servername.domainname.com/CN=Users,
DC=domainname,DC=com''
WHERE objectCategory = ''Person'' AND objectClass = ''user'' order by
name')

This is pulling from a container called users, only the class and
category of user. If you have users in seperate OU's you would specify
them by 'OU='

NOTE: I changed the DNS info, you will have to input yours.

HTH

Ray Higdon MCSE, MCDBA, CCNA

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by FloridaJoe | last post: by
62 posts views Thread by Bryan Dickerson | last post: by
1 post views Thread by Pradeep | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.