ODBC Driver to Sage works, Linked Server fails with SQLSetConnectAttr failed

SOLVED

Hello-

I'm having trouble getting a linked server to our Sage instance working.  The ODBC driver tests successfully, but the linked server always returns the same error- SQLSetConnectAttr failed.  Confoundingly it does work on our Staging environment reliably, and I'm using the same script to create the linked server on our Production environment. I've also configured the ODBC Driver in the exact same way as Staging. I realize this has been posted before and I've followed all the advice I've seen given in other posts. Including:

  • Creating the linked server with a direct call to the driver
  • Ensuring the System DSN is 64bit and SQL Server is as well
  • The user SQL runs as has permissions to the Sage installation directory (Same domain user as staging, so I know it's valid)
  • MSDASQL Provider options only has Level Zero Only and Allow In Process checked
  • Verified that there is no firewall between the two machines (and I can access the share from the server itself)
  • Enabled Ad Hoc Distributed Queries

None of this has had any impact, and I continue to get the same error.  Any help is greatly appreciated

Thanks!

Error text:

OLE DB provider "MSDASQL" for linked server "redacted" returned message "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed".
OLE DB provider "MSDASQL" for linked server "redacted" returned message "[ProvideX][ODBC Driver][PVKIO]Logon failed". (Microsoft SQL Server, Error: 7303)

  • 0

    The ProvideX ODBC Driver requires user ID, password and company code to connect. Creating a system DSN with this embedded allow you to connect without the validation step.

  • 0

    Does your Sage 100 use unified login?  Make sure the SQL service Windows (domain) account has Sage 100 access, and use a SQL login when connecting with SSMS (instead of Windows authentication).

  • 0 in reply to Kevin M

    Thank you for the response Kevin.  I'll have to look into your first question, I've been treating our Sage instance largely as a black box given the linked server works on our staging environment. Our staging sql environment runs with the same account as production, which is another problem in of itself, but that tells me the domain account it's running as has the necessary permissions.  There is a user defined in the DSN, and I just verified the connection string is the same as our staging environment.  If it's of any help, here's our connection string as produced from ODBC with some replacements-

    DSN=SameAsSystemDSN; UID=user; PWD=pass; Directory=\\sage\MAS90; Prefix=\\sage\MAS90\SY\, \\sage\MAS90\==\; ViewDLL=\\sage\MAS90\Home\; Company=SameAsStaging; LogFile=\PVXODBC.LOG; CacheSize=4; DirtyReads=1; BurstMode=1; StripTrailingSpaces=1; SERVER=NotTheServer

    It may also be worth noting that the only functional difference between our Staging and Prod is Prod is an availability group with multiple machines running in sync; however linked servers are excluded from the sync process, so I've assumed that to have no impact but I could be mistaken.

  • 0 in reply to Dave D

    Configure SQL Server options

    From MS SQL Server Management Studio

    Scroll to Server Objects => Linked Servers => Providers

    Right Click MSDASQL => Properties

    The only options selected should be “Allow in Process” & “Level zero only

    Select the above options and click OK

    From The SQL Server “New Query”

    sp_configure 'show advanced options', 1;

    RECONFIGURE;

    GO

    sp_configure 'Ad Hoc Distributed Queries', 1;

    RECONFIGURE;

    GO

    Execute the query

  • 0 in reply to Kevin M

    I've verified the correct options are selected for the MSDASQL Provider, and ran that SQL again-

    Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
    Configuration option 'Ad Hoc Distributed Queries' changed from 1 to 1. Run the RECONFIGURE statement to install.

  • +1
    verified answer

    As far as I can tell, the solution here was to uninstall and reinstall the Sage ODBC drivers and recreate the connection from scratch.

    Cheers to anyone that works for another five years down the road.