Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Access to the remote server is denied because the

Author  Topic 

hodgesp
Starting Member

1 Post

Posted - 2010-05-11 : 13:45:14
Greetings Programs! (remember Tron)

I have a .Net application I am designing in C# .Net. Much of my data I garner from views I created based on tables and views from external datasources, ie other databases on the same local server as my main database and from databases on "Linked Servers".

My database sources are all SQL 2005. I have a couple issues concerning remote access. One I beleive I resolved concerning accessing another database on the same server.

BTW:I Am using SQL Authintication.

I have set up a security paradyme where I use one account "abcUser" in my application to connect to the database and it can only execute stored procedures. I use an "EXECUTE AS" clause to run sql scripts as another user "abcRun" for added security. The account I use has db_datareader and db_datawriter on the main database.

I also graneted the second account, "abcRun" ,db_datareader on another database on the same "Local" server. Made my main database a trusted source, and added the database owner basic access to the external database with "AUTHINTICATE" access.

This fixed my first issue of access an external database on the Local server as my main datasource.

However, I still seem to have an issue with access to data via linked servers. I set up the linked server with a base access account as a fall back but made specific "Local server login to remote server login mappings:"

I added the account I use as the "Execute AS", "abcRun" , to the linked server with ,db_datareader access to the database I am targeting.
I get this error when I attempt to run a query against the linked server datasource:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: ME (^8
-- Create date: 04.5.2010
-- Description: Select data Table records--
-- =============================================
ALTER PROCEDURE [dbo].[spu_dataSelect]
-- Add the parameters for the stored procedure here
@commandString VARCHAR(4000)
--
With Execute As 'abcRun'
AS
BEGIN
SET NOCOUNT ON;
-- Select descr , recid from dbo.contact_types_support
-- EXECUTE AS LOGIN ='abcRun'

Execute(@commandString);
Revert
-------------------------------------------------------
-- Print(@commandString) --debugg line
-------------------------------------------------------
END
[/code]



I am not sure what to do at this point. Any suggestions or help would be appreciated.

   

- Advertisement -