Error while querying Linked server

  • Hi all, I am a newbie to SQL Server. I have SQL Server 2008 R2 installed on a server machine and a linked server setup to an AS400 database using a IBMDASQL OLEDB Provider.

    I was able to run queries against the AS400 database via the linked server using the four part query approach "Linkedserver"."Database"."Schema"."Table" till recently. For example

    Select *

    from "AS400"."AS400DB"."SPRDQY"."CRYRECDL6"

    All of a sudden when my queries started to fail throwing of an error about the provider.

    Msg 7399, Level 16, State 1, Line 1

    The OLE DB provider "IBMDASQL" for linked server "AS400" reported an error. The provider did not give any information about the error.

    Msg 7330, Level 16, State 2, Line 1

    Cannot fetch a row from OLE DB provider "IBMDASQL" for linked server "AS400".

    The strange part is that when I run the same select statement in ssms on my client machine connected to the same server instead of directly in the ssms on the server machine, the query works fine and gets me the data from the AS400.

    SSMS on both machines is sql server 2008 r2.

    I am wondering what settings in my SSMS on the server machine that are different than the one on my client thats causing the error.

    Any help would be appreciated..

    ___________________________________________________________________
    If I can answer a question then anyone can answer it..trying to reverse the logic.. :hehe:

  • Quoted_identifier

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • Thanks for the reply..

    Quoted identifier is already on. turning it off is throwing incorrect syntax error. I believe it has something to do with the Oledb provider seetings but what I dont understand is how can the provider work fine for the linked server when queried through the client machine instead of directly on server.. 🙁

    ___________________________________________________________________
    If I can answer a question then anyone can answer it..trying to reverse the logic.. :hehe:

  • Do you connect with the same user (Login) to sql server in both cases? Is SSMS started with "run as admin" ?

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • Thanks for the reply. I did find the soultion. The allow_inprocess option in the properties dialogue box for the OLEDB provider should be checked. I didn't completely understand for what this option is meant for but by trial and error, I found that if I uncheck this option, queries against the linked server on the server machine are not fetching the data throwing the above mentioned error. If I check this option (sometimes need to restart the sql server) queries against the linked server on the server machine work fine. Another thing I found while playing with this option is that this setting doesn't effect the sql server on 32 bit machines but only for 64 bit machines.

    To answer your question above I do connect with the same login and the ssms is ran as admin. I am absolutely positive that allow_inprocess is the culprit (unless there is a bug) and now everything works fine for me.

    ___________________________________________________________________
    If I can answer a question then anyone can answer it..trying to reverse the logic.. :hehe:

  • Bravo! I used "allow inprocess" to make some db links to work (e.g. when connecting to oracle), but completely forgot that maybe that can help your case.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply