Link to home
Start Free TrialLog in
Avatar of raGadiraju
raGadiraju

asked on

linked server error

Using openquery through my application I got this error:

       <[Microsoft][ODBC SQL Server Driver][SQL Server]The OLE DB provider "ADSDSOObject"
      for linked server "ADSI" reported an error. The provider indicates that the user did not have the permission to perform the
      operation.>.>.

Iam running a select query using openquery.

any help is greatly appreciated.

Thanks
Avatar of ptjcb
ptjcb
Flag of United States of America image

Are both database using Windows or SQL authentication? Are the servers on the same domain?
If you logged in with SQL Server authentication then make sure you have privilages to the linked database.
Avatar of raGadiraju
raGadiraju

ASKER

I have both windows and sql auth.

How do I make sure I have all the privileges. What specific privileges should I check for and where? I am kind of new to sql server.

Tahnks
ADSI is the Active Directory. Do you have the necessary rights?

You have to add the linked server login.


usage of sp_addlinkedsrvlogin:

sp_addlinkedsrvlogin [ @rmtsrvname = ] 'rmtsrvname'
[ , [ @useself = ] 'useself' ]
[ , [ @locallogin = ] 'locallogin' ]
[ , [ @rmtuser = ] 'rmtuser' ]
[ , [ @rmtpassword = ] 'rmtpassword' ]

For example,

EXEC sp_addlinkedsrvlogin 'ADSI', false, 'sa', 'Administrator', 'password'
hI PTJCB:

Ia m trying to run that proc. I will keep u posted.

Thanks
Raj
I ran the stored proc and here's what I see:

Msg 7399, Level 16, State 1, Line 2
The OLE DB provider "ADSDSOObject" for linked server "ADSI" reported an error. The provider indicates that the user did not have the permission to perform the operation.
Msg 7321, Level 16, State 2, Line 2
An error occurred while preparing the query "SELECT givenname,sn,objectGUID,userPrincipalName,samAccountName,displayname

     FROM 'LDAP://usnjpar1wdc01.us.ad.irmc.com'

     WHERE objectCategory = 'Person' AND objectClass= 'user'

       AND samAccountName='PPandit'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".
ASKER CERTIFIED SOLUTION
Avatar of ptjcb
ptjcb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial