We’re currently using EasySoft’s excellent Salesforce ODBC Driver to be able to treat our Salesforce org as if it were another SQL database (really useful for updating legacy stored procedures by rewriting queries that reference migrated Dynamics tables to query Salesforce instead!) We were working on updating a particular page in our website that needed to use it but was running into permissions issues when querying it, the error was:
Access to the remote server is denied because no login-mapping exists
For future reference, this means that the account the website was connecting with wasn’t granted permission to connect to the ODBC driver since it’s set up as a “Linked Server”, and SQL server doesn’t just let you query those unless you’ve got sysadmin privileges, or unless the account is specifically set up to connect to them. Here’s the code I used to resolve the issue:
–removing previous login, because I had to tweak this a few times
exec sp_droplinkedsrvlogin @rmtsrvname= ‘easysoft connection name’ ,
@locallogin= ‘db login name'
exec sp_addlinkedsrvlogin @rmtsrvname = ‘easysoft connection name’,
@locallogin = ‘db login name’,
@useself = false, –defaults to true and ignores the below
@rmtuser = ‘salesforce username’, –already specified in easysoft config, still have to specify it here for some reason
@rmtpassword = ‘salesforce pw'