Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 OPENROWSET with ADsDSOObject

Author  Topic 

chrisSol
Starting Member

1 Post

Posted - 2010-05-05 : 16:22:11
Hi,

I have a stored procedure that pulls data from Active Directory by executing the following query:

select *
FROM
OPENROWSET(
'ADsDSOObject', 'User ID=myid; Password=mypassword; ADSI Flag=0x11;Page Size=10000',
'SELECT sn FROM ''LDAP://SERVERNAME/ DC=MyDC, DC=ca'' WHERE objectCategory = ''Person''
')


This query works on every one of my SQL Server 2005 instances but one (all instances are identical installs).
When I try to run it on the Server which doesn't work I get the following error message:

Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT sn FROM ...." for execution against OLE DB provider "AdsDsoObject" for linked server "(null)".


I have tried every which way to get it to work on the one failing server.
I know the query is correct since it works everywhere else.
I am further baffled because I can pull this data on this server by using OPENQUERY in conjunction with a linked server (which is configured in the same way as specified in the OPENROWSET command) by running:

SELECT * FROM OPENQUERY( linkedServer, 'SELECT sn FROM ..... ' )

This proves that the credentials are correct and the SQL server can communicate with the domain controller. However, I need to get the OPENROWSET method working, so simply switching to the OPENQUERY way is not an option.

I am thinking it must be an obscure error in the server configuration, but I can't for the life of me figure it out...

Any ideas?

Thanks,

Chris
   

- Advertisement -