Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

SQL Server 2000 & Active Directory: Problems querying

Question posted by: James Allan (Guest) on July 20th, 2005 01:02 AM
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=Person)(objectClass=User));name,ad spath'
)

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
Simon Hayes's Avatar
Simon Hayes
Guest
n/a Posts
July 20th, 2005
01:02 AM
#2

Re: SQL Server 2000 & Active Directory: Problems querying
"James Allan" <james@allan-home.co.uk> wrote in message
news:2f66e2a4.0308040526.a0be98a@posting.google.co m...[color=blue]
> 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,
>[/color]
'<LDAP://CN=Users,DC=MyDomain,DC=com>;(&(objectCategory=Person)(objectClass=
User));name,adspath'[color=blue]
> )
>
> 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[/color]

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=...%40cpmsftngxa06

Simon




Ray Higdon's Avatar
Ray Higdon
Guest
n/a Posts
July 20th, 2005
01:07 AM
#3

Re: SQL Server 2000 & Active Directory: Problems querying
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!

 
Not the answer you were looking for? Post your question . . .
189,085 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors