toleolu
toleolu

Reputation: 77

AD query works in SQL Server 2005 but not in SQL Server 2008 R2

Note: Active Directory is running on Windows Server 2003 32 bit.

This query works on our current production SQL Server 2005 32 bit server:

select 
    cn, samaccountname, mail, co, distinguishedName, displayName
from 
    openquery(ADSI, 'SELECT cn,samaccountname, mail, co, distinguishedName, displayName
                     FROM ''LDAP://<ourDomain>''  ')

But when I run it on SQL Server 2008 R2 64 bit, I get an error:

Msg 7330, Level 16 State 2, Line 1
Cannot fetch a row from OLE DB provider "AdsDSOObject" for linked server "ADSI".

The linked server connection on the SQL Server 2008 R2 tests OK, everything is configured the same as SQL Server 2005. The most common fix I found online said to make sure InProcess is checked in the AdsDSOObject properties, which it is.

Any help greatly appreciated.

Upvotes: 0

Views: 685

Answers (1)

toleolu
toleolu

Reputation: 77

Holy crap, found it. I don't know if it applies across the board in all circumstances like this, but in my case, I needed to change:

FROM ''LDAP://ou=????, dc=????, dc=???'' '

to

FROM ''LDAP://domainName.org/ou=???, dc=????, dc=????'' '

Hope this might be of help to other noobs like myself.

Mahalo

Upvotes: 1

Related Questions