linked server error

Posted on 2007-10-12
Last Modified: 2007-10-14
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

Iam running a select query using openquery.

any help is greatly appreciated.

Question by:raGadiraju
    LVL 27

    Expert Comment

    Are both database using Windows or SQL authentication? Are the servers on the same domain?
    LVL 16

    Expert Comment

    If you logged in with SQL Server authentication then make sure you have privilages to the linked database.

    Author Comment

    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.

    LVL 27

    Expert Comment

    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'

    Author Comment

    hI PTJCB:

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


    Author Comment

    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://'

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

           AND samAccountName='PPandit'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".
    LVL 27

    Accepted Solution

    OK. You may not have the rights to run access the Active Directory.

    Right-click My Computer, Manage, Service. Find the SQL Server service. Double-click and you should see the Log on tab.

    What does it say. If you are logged on as a Local System, you do not have network privileges. You need to log on to SQL Server with an account that has domain privileges and permissions in the AD (I have no idea which account that would be, it's your network).


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now