PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > sql 2005 ownership chaining with views
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
sql 2005 ownership chaining with views

Réponse
 
LinkBack Outils de la discussion
Vieux 21/05/2008, 18h24   #1
chumshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut sql 2005 ownership chaining with views

I am trying to set-up the following scenario: We have a centralized
set of databases with access restricted to a select few. Let's call
one of those databases CentralDB. We have many applications that will
access this data in a read only manner and to keep the applications
separate from one another we place them in their own databases. Let's
call one ApplicationB. Both databases have had their ownership
changed to 'sa' and they both have 'db chaining' enabled. I have a
table within the CentralDB, AllData, which was created under the dbo
schema and looks like this: dbo.AllData. A view was created in the
ApplicationB database, under the dbo schema and looks like this:
dbo.TheView. The view structure is as follows:

Create View [dbo].[TheView]
(Name)
as
select col1
from CentralDB.dbo.AllData

Within the ApplicationB database I have a user, AppUser, which is a
sql server authenticated login and exists with data_reader/data_writer
permission in ApplicationB database only. I grant select on TheView
to AppUser. When I try to run the select I get the following error:

Msg 916, Level 14, State 1, Line 1
The server principal "AppUser" is not able to access the database
"CentralDB" under the current security context.

I have read every article I can find on this topic and I cannot see
why this is failing. The databases are both owned by SA and both the
table and view are created using the dbo schema and are therefor owned
by dbo. I have granted select permission on the view, TheView, to
AppUser. My guess is that somewhere along the way the chain is being
broken. Does anyone have any ideas what is failing? I do understand
that I can simply add AppUser to the CentralDB, but the purpose of
this set-up was to have applications be self-contained and restrict
access to CentralDB.


Thanks,
Josef
  Réponse avec citation
Vieux 21/05/2008, 19h10   #2
Alejandro Mesa
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: sql 2005 ownership chaining with views

chumshack,

What is the default schema of that user?


AMB

"chumshack" wrote:

> I am trying to set-up the following scenario: We have a centralized
> set of databases with access restricted to a select few. Let's call
> one of those databases CentralDB. We have many applications that will
> access this data in a read only manner and to keep the applications
> separate from one another we place them in their own databases. Let's
> call one ApplicationB. Both databases have had their ownership
> changed to 'sa' and they both have 'db chaining' enabled. I have a
> table within the CentralDB, AllData, which was created under the dbo
> schema and looks like this: dbo.AllData. A view was created in the
> ApplicationB database, under the dbo schema and looks like this:
> dbo.TheView. The view structure is as follows:
>
> Create View [dbo].[TheView]
> (Name)
> as
> select col1
> from CentralDB.dbo.AllData
>
> Within the ApplicationB database I have a user, AppUser, which is a
> sql server authenticated login and exists with data_reader/data_writer
> permission in ApplicationB database only. I grant select on TheView
> to AppUser. When I try to run the select I get the following error:
>
> Msg 916, Level 14, State 1, Line 1
> The server principal "AppUser" is not able to access the database
> "CentralDB" under the current security context.
>
> I have read every article I can find on this topic and I cannot see
> why this is failing. The databases are both owned by SA and both the
> table and view are created using the dbo schema and are therefor owned
> by dbo. I have granted select permission on the view, TheView, to
> AppUser. My guess is that somewhere along the way the chain is being
> broken. Does anyone have any ideas what is failing? I do understand
> that I can simply add AppUser to the CentralDB, but the purpose of
> this set-up was to have applications be self-contained and restrict
> access to CentralDB.
>
>
> Thanks,
> Josef
>

  Réponse avec citation
Vieux 21/05/2008, 19h40   #3
chumshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

On May 21, 1:10pm, Alejandro Mesa
<AlejandroM...@discussions.microsoft.com> wrote:
> chumshack,
>
> What is the default schema of that user?
>
> AMB
>
>
>
> "chumshack" wrote:
> > I am trying to set-up the following scenario: We have a centralized
> > set of databases with access restricted to a select few. Let's call
> > one of those databases CentralDB. We have many applications that will
> > access this data in a read only manner and to keep the applications
> > separate from one another we place them in their own databases. Let's
> > call one ApplicationB. Both databases have had their ownership
> > changed to 'sa' and they both have 'db chaining' enabled. I have a
> > table within the CentralDB, AllData, which was created under the dbo
> > schema and looks like this: dbo.AllData. A view was created in the
> > ApplicationB database, under the dbo schema and looks like this:
> > dbo.TheView. The view structure is as follows:

>
> > Create View [dbo].[TheView]
> > (Name)
> > as
> > select col1
> > from CentralDB.dbo.AllData

>
> > Within the ApplicationB database I have a user, AppUser, which is a
> > sql server authenticated login and exists with data_reader/data_writer
> > permission in ApplicationB database only. I grant select on TheView
> > to AppUser. When I try to run the select I get the following error:

>
> > Msg 916, Level 14, State 1, Line 1
> > The server principal "AppUser" is not able to access the database
> > "CentralDB" under the current security context.

>
> > I have read every article I can find on this topic and I cannot see
> > why this is failing. The databases are both owned by SA and both the
> > table and view are created using the dbo schema and are therefor owned
> > by dbo. I have granted select permission on the view, TheView, to
> > AppUser. My guess is that somewhere along the way the chain is being
> > broken. Does anyone have any ideas what is failing? I do understand
> > that I can simply add AppUser to the CentralDB, but the purpose of
> > this set-up was to have applications be self-contained and restrict
> > access to CentralDB.

>
> > Thanks,
> > Josef- Hide quoted text -

>
> - Show quoted text -


dbo
  Réponse avec citation
Vieux 22/05/2008, 02h52   #4
Dan Guzman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

> I have read every article I can find on this topic and I cannot see
> why this is failing. The databases are both owned by SA and both the
> table and view are created using the dbo schema and are therefor owned
> by dbo. I have granted select permission on the view, TheView, to
> AppUser. My guess is that somewhere along the way the chain is being
> broken. Does anyone have any ideas what is failing? I do understand
> that I can simply add AppUser to the CentralDB, but the purpose of
> this set-up was to have applications be self-contained and restrict
> access to CentralDB.


A user must have a security context in order to access a database. If you
don't want to add the user to CentralDB, you can enable the guest user
instead. No permissions need to be granted on the table in either case.

--
Hope this s.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"chumshack" <sqlrunner@gmail.com> wrote in message
news:4b075fbf-c55f-4de9-8bad-0c783f293d02@m44g2000hsc.googlegroups.com...
>I am trying to set-up the following scenario: We have a centralized
> set of databases with access restricted to a select few. Let's call
> one of those databases CentralDB. We have many applications that will
> access this data in a read only manner and to keep the applications
> separate from one another we place them in their own databases. Let's
> call one ApplicationB. Both databases have had their ownership
> changed to 'sa' and they both have 'db chaining' enabled. I have a
> table within the CentralDB, AllData, which was created under the dbo
> schema and looks like this: dbo.AllData. A view was created in the
> ApplicationB database, under the dbo schema and looks like this:
> dbo.TheView. The view structure is as follows:
>
> Create View [dbo].[TheView]
> (Name)
> as
> select col1
> from CentralDB.dbo.AllData
>
> Within the ApplicationB database I have a user, AppUser, which is a
> sql server authenticated login and exists with data_reader/data_writer
> permission in ApplicationB database only. I grant select on TheView
> to AppUser. When I try to run the select I get the following error:
>
> Msg 916, Level 14, State 1, Line 1
> The server principal "AppUser" is not able to access the database
> "CentralDB" under the current security context.
>
> I have read every article I can find on this topic and I cannot see
> why this is failing. The databases are both owned by SA and both the
> table and view are created using the dbo schema and are therefor owned
> by dbo. I have granted select permission on the view, TheView, to
> AppUser. My guess is that somewhere along the way the chain is being
> broken. Does anyone have any ideas what is failing? I do understand
> that I can simply add AppUser to the CentralDB, but the purpose of
> this set-up was to have applications be self-contained and restrict
> access to CentralDB.
>
>
> Thanks,
> Josef


  Réponse avec citation
Vieux 22/05/2008, 14h29   #5
chumshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

On May 21, 8:52pm, "Dan Guzman" <guzma...@nospam-
online.sbcglobal.net> wrote:
> > I have read every article I can find on this topic and I cannot see
> > why this is failing. The databases are both owned by SA and both the
> > table and view are created using the dbo schema and are therefor owned
> > by dbo. I have granted select permission on the view, TheView, to
> > AppUser. My guess is that somewhere along the way the chain is being
> > broken. Does anyone have any ideas what is failing? I do understand
> > that I can simply add AppUser to the CentralDB, but the purpose of
> > this set-up was to have applications be self-contained and restrict
> > access to CentralDB.

>
> A user must have a security context in order to access a database. If you
> don't want to add the user to CentralDB, you can enable the guest user
> instead. No permissions need to be granted on the table in either case.
>
> --
> Hope this s.
>
> Dan Guzman
> SQL Server MVPhttp://weblogs.sqlteam.com/dang/
>
> "chumshack" <sqlrun...@gmail.com> wrote in message
>
> news:4b075fbf-c55f-4de9-8bad-0c783f293d02@m44g2000hsc.googlegroups.com...
>
>
>
> >I am trying to set-up the following scenario: We have a centralized
> > set of databases with access restricted to a select few. Let's call
> > one of those databases CentralDB. We have many applications that will
> > access this data in a read only manner and to keep the applications
> > separate from one another we place them in their own databases. Let's
> > call one ApplicationB. Both databases have had theirownership
> > changed to 'sa' and they both have 'dbchaining' enabled. I have a
> > table within the CentralDB, AllData, which was created under the dbo
> > schema and looks like this: dbo.AllData. A view was created in the
> > ApplicationB database, under the dbo schema and looks like this:
> > dbo.TheView. The view structure is as follows:

>
> > Create View [dbo].[TheView]
> > (Name)
> > as
> > select col1
> > from CentralDB.dbo.AllData

>
> > Within the ApplicationB database I have a user, AppUser, which is a
> > sql server authenticated login and exists with data_reader/data_writer
> > permission in ApplicationB database only. I grant select on TheView
> > to AppUser. When I try to run the select I get the following error:

>
> > Msg 916, Level 14, State 1, Line 1
> > The server principal "AppUser" is not able to access the database
> > "CentralDB" under the current security context.

>
> > I have read every article I can find on this topic and I cannot see
> > why this is failing. The databases are both owned by SA and both the
> > table and view are created using the dbo schema and are therefor owned
> > by dbo. I have granted select permission on the view, TheView, to
> > AppUser. My guess is that somewhere along the way the chain is being
> > broken. Does anyone have any ideas what is failing? I do understand
> > that I can simply add AppUser to the CentralDB, but the purpose of
> > this set-up was to have applications be self-contained and restrict
> > access to CentralDB.

>
> > Thanks,
> > Josef- Hide quoted text -

>
> - Show quoted text -


The guest user does exist within the CentralDB, so the question I have
now is how to I link the user, and all users outside of CentralDB, to
use the guest user account when moving between databases?
  Réponse avec citation
Vieux 22/05/2008, 14h48   #6
chumshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

On May 22, 8:29am, chumshack <sqlrun...@gmail.com> wrote:
> On May 21, 8:52pm, "Dan Guzman" <guzma...@nospam-
>
>
>
>
>
> online.sbcglobal.net> wrote:
> > > I have read every article I can find on this topic and I cannot see
> > > why this is failing. The databases are both owned by SA and both the
> > > table and view are created using the dbo schema and are therefor owned
> > > by dbo. I have granted select permission on the view, TheView, to
> > > AppUser. My guess is that somewhere along the way the chain is being
> > > broken. Does anyone have any ideas what is failing? I do understand
> > > that I can simply add AppUser to the CentralDB, but the purpose of
> > > this set-up was to have applications be self-contained and restrict
> > > access to CentralDB.

>
> > A user must have a security context in order to access a database. Ifyou
> > don't want to add the user to CentralDB, you can enable the guest user
> > instead. No permissions need to be granted on the table in either case.

>
> > --
> > Hope this s.

>
> > Dan Guzman
> > SQL Server MVPhttp://weblogs.sqlteam.com/dang/

>
> > "chumshack" <sqlrun...@gmail.com> wrote in message

>
> >news:4b075fbf-c55f-4de9-8bad-0c783f293d02@m44g2000hsc.googlegroups.com...

>
> > >I am trying to set-up the following scenario: We have a centralized
> > > set of databases with access restricted to a select few. Let's call
> > > one of those databases CentralDB. We have many applications that will
> > > access this data in a read only manner and to keep the applications
> > > separate from one another we place them in their own databases. Let's
> > > call one ApplicationB. Both databases have had theirownership
> > > changed to 'sa' and they both have 'dbchaining' enabled. I have a
> > > table within the CentralDB, AllData, which was created under the dbo
> > > schema and looks like this: dbo.AllData. A view was created in the
> > > ApplicationB database, under the dbo schema and looks like this:
> > > dbo.TheView. The view structure is as follows:

>
> > > Create View [dbo].[TheView]
> > > (Name)
> > > as
> > > select col1
> > > from CentralDB.dbo.AllData

>
> > > Within the ApplicationB database I have a user, AppUser, which is a
> > > sql server authenticated login and exists with data_reader/data_writer
> > > permission in ApplicationB database only. I grant select on TheView
> > > to AppUser. When I try to run the select I get the following error:

>
> > > Msg 916, Level 14, State 1, Line 1
> > > The server principal "AppUser" is not able to access the database
> > > "CentralDB" under the current security context.

>
> > > I have read every article I can find on this topic and I cannot see
> > > why this is failing. The databases are both owned by SA and both the
> > > table and view are created using the dbo schema and are therefor owned
> > > by dbo. I have granted select permission on the view, TheView, to
> > > AppUser. My guess is that somewhere along the way the chain is being
> > > broken. Does anyone have any ideas what is failing? I do understand
> > > that I can simply add AppUser to the CentralDB, but the purpose of
> > > this set-up was to have applications be self-contained and restrict
> > > access to CentralDB.

>
> > > Thanks,
> > > Josef- Hide quoted text -

>
> > - Show quoted text -

>
> The guest user does exist within the CentralDB, so the question I have
> now is how to I link the user, and all users outside of CentralDB, to
> use the guest user account when moving between databases?- Hide quoted text -
>
> - Show quoted text -


NVM, I got it thank you for the Dan, it fixed the issue.

  Réponse avec citation
Vieux 23/05/2008, 13h24   #7
Dan Guzman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

I'm glad you were able to get it going.

--
Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"chumshack" <sqlrunner@gmail.com> wrote in message
news:f9cc20a1-f493-4750-a95f-c183bc3c411e@8g2000hse.googlegroups.com...
On May 22, 8:29 am, chumshack <sqlrun...@gmail.com> wrote:
> On May 21, 8:52 pm, "Dan Guzman" <guzma...@nospam-
>
>
>
>
>
> online.sbcglobal.net> wrote:
> > > I have read every article I can find on this topic and I cannot see
> > > why this is failing. The databases are both owned by SA and both the
> > > table and view are created using the dbo schema and are therefor owned
> > > by dbo. I have granted select permission on the view, TheView, to
> > > AppUser. My guess is that somewhere along the way the chain is being
> > > broken. Does anyone have any ideas what is failing? I do understand
> > > that I can simply add AppUser to the CentralDB, but the purpose of
> > > this set-up was to have applications be self-contained and restrict
> > > access to CentralDB.

>
> > A user must have a security context in order to access a database. If
> > you
> > don't want to add the user to CentralDB, you can enable the guest user
> > instead. No permissions need to be granted on the table in either case.

>
> > --
> > Hope this s.

>
> > Dan Guzman
> > SQL Server MVPhttp://weblogs.sqlteam.com/dang/

>
> > "chumshack" <sqlrun...@gmail.com> wrote in message

>
> >news:4b075fbf-c55f-4de9-8bad-0c783f293d02@m44g2000hsc.googlegroups.com...

>
> > >I am trying to set-up the following scenario: We have a centralized
> > > set of databases with access restricted to a select few. Let's call
> > > one of those databases CentralDB. We have many applications that will
> > > access this data in a read only manner and to keep the applications
> > > separate from one another we place them in their own databases. Let's
> > > call one ApplicationB. Both databases have had theirownership
> > > changed to 'sa' and they both have 'dbchaining' enabled. I have a
> > > table within the CentralDB, AllData, which was created under the dbo
> > > schema and looks like this: dbo.AllData. A view was created in the
> > > ApplicationB database, under the dbo schema and looks like this:
> > > dbo.TheView. The view structure is as follows:

>
> > > Create View [dbo].[TheView]
> > > (Name)
> > > as
> > > select col1
> > > from CentralDB.dbo.AllData

>
> > > Within the ApplicationB database I have a user, AppUser, which is a
> > > sql server authenticated login and exists with data_reader/data_writer
> > > permission in ApplicationB database only. I grant select on TheView
> > > to AppUser. When I try to run the select I get the following error:

>
> > > Msg 916, Level 14, State 1, Line 1
> > > The server principal "AppUser" is not able to access the database
> > > "CentralDB" under the current security context.

>
> > > I have read every article I can find on this topic and I cannot see
> > > why this is failing. The databases are both owned by SA and both the
> > > table and view are created using the dbo schema and are therefor owned
> > > by dbo. I have granted select permission on the view, TheView, to
> > > AppUser. My guess is that somewhere along the way the chain is being
> > > broken. Does anyone have any ideas what is failing? I do understand
> > > that I can simply add AppUser to the CentralDB, but the purpose of
> > > this set-up was to have applications be self-contained and restrict
> > > access to CentralDB.

>
> > > Thanks,
> > > Josef- Hide quoted text -

>
> > - Show quoted text -

>
> The guest user does exist within the CentralDB, so the question I have
> now is how to I link the user, and all users outside of CentralDB, to
> use the guest user account when moving between databases?- Hide quoted
> text -
>
> - Show quoted text -


NVM, I got it thank you for the Dan, it fixed the issue.

  Réponse avec citation
Vieux 16/08/2008, 01h51   #8
Warren
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

OK you were able to get it going; but HOW?
I have gone through all the same scenario and can't get this working.



"Dan Guzman" wrote:

> I'm glad you were able to get it going.
>
> --
> Dan Guzman
> SQL Server MVP
> http://weblogs.sqlteam.com/dang/
>
> "chumshack" <sqlrunner@gmail.com> wrote in message
> news:f9cc20a1-f493-4750-a95f-c183bc3c411e@8g2000hse.googlegroups.com...
> On May 22, 8:29 am, chumshack <sqlrun...@gmail.com> wrote:
> > On May 21, 8:52 pm, "Dan Guzman" <guzma...@nospam-
> >
> >
> >
> >
> >
> > online.sbcglobal.net> wrote:
> > > > I have read every article I can find on this topic and I cannot see
> > > > why this is failing. The databases are both owned by SA and both the
> > > > table and view are created using the dbo schema and are therefor owned
> > > > by dbo. I have granted select permission on the view, TheView, to
> > > > AppUser. My guess is that somewhere along the way the chain is being
> > > > broken. Does anyone have any ideas what is failing? I do understand
> > > > that I can simply add AppUser to the CentralDB, but the purpose of
> > > > this set-up was to have applications be self-contained and restrict
> > > > access to CentralDB.

> >
> > > A user must have a security context in order to access a database. If
> > > you
> > > don't want to add the user to CentralDB, you can enable the guest user
> > > instead. No permissions need to be granted on the table in either case.

> >
> > > --
> > > Hope this s.

> >
> > > Dan Guzman
> > > SQL Server MVPhttp://weblogs.sqlteam.com/dang/

> >
> > > "chumshack" <sqlrun...@gmail.com> wrote in message

> >
> > >news:4b075fbf-c55f-4de9-8bad-0c783f293d02@m44g2000hsc.googlegroups.com...

> >
> > > >I am trying to set-up the following scenario: We have a centralized
> > > > set of databases with access restricted to a select few. Let's call
> > > > one of those databases CentralDB. We have many applications that will
> > > > access this data in a read only manner and to keep the applications
> > > > separate from one another we place them in their own databases. Let's
> > > > call one ApplicationB. Both databases have had theirownership
> > > > changed to 'sa' and they both have 'dbchaining' enabled. I have a
> > > > table within the CentralDB, AllData, which was created under the dbo
> > > > schema and looks like this: dbo.AllData. A view was created in the
> > > > ApplicationB database, under the dbo schema and looks like this:
> > > > dbo.TheView. The view structure is as follows:

> >
> > > > Create View [dbo].[TheView]
> > > > (Name)
> > > > as
> > > > select col1
> > > > from CentralDB.dbo.AllData

> >
> > > > Within the ApplicationB database I have a user, AppUser, which is a
> > > > sql server authenticated login and exists with data_reader/data_writer
> > > > permission in ApplicationB database only. I grant select on TheView
> > > > to AppUser. When I try to run the select I get the following error:

> >
> > > > Msg 916, Level 14, State 1, Line 1
> > > > The server principal "AppUser" is not able to access the database
> > > > "CentralDB" under the current security context.

> >
> > > > I have read every article I can find on this topic and I cannot see
> > > > why this is failing. The databases are both owned by SA and both the
> > > > table and view are created using the dbo schema and are therefor owned
> > > > by dbo. I have granted select permission on the view, TheView, to
> > > > AppUser. My guess is that somewhere along the way the chain is being
> > > > broken. Does anyone have any ideas what is failing? I do understand
> > > > that I can simply add AppUser to the CentralDB, but the purpose of
> > > > this set-up was to have applications be self-contained and restrict
> > > > access to CentralDB.

> >
> > > > Thanks,
> > > > Josef- Hide quoted text -

> >
> > > - Show quoted text -

> >
> > The guest user does exist within the CentralDB, so the question I have
> > now is how to I link the user, and all users outside of CentralDB, to
> > use the guest user account when moving between databases?- Hide quoted
> > text -
> >
> > - Show quoted text -

>
> NVM, I got it thank you for the Dan, it fixed the issue.
>

  Réponse avec citation
Vieux 16/08/2008, 02h45   #9
Dan Guzman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sql 2005 ownership chaining with views

> OK you were able to get it going; but HOW?
> I have gone through all the same scenario and can't get this working.


Below is a demo script (gleaned from another thread today) that shows how to
set cross-database chaining using a view. Note that db chaining should be
enabled in an sa-owned database when only sysadmin role members can create
dbo-owned objects in the database.

-- SETUP test login
CREATE LOGIN Bob WITH PASSWORD = 'password*1';

-- SETUP SalesDB
CREATE DATABASE SalesDB WITH DB_CHAINING ON;
ALTER AUTHORIZATION ON DATABASE::SalesDB TO sa;
GO
USE SalesDB;
GO
CREATE USER guest; --or create user account in this database
CREATE TABLE Sales (TransactionID int, Amount smallmoney);
INSERT INTO Sales (TransactionID, Amount) VALUES (1, 123.45);
GO

-- SETUP ReportsDB
CREATE DATABASE ReportsDB WITH DB_CHAINING ON;
ALTER AUTHORIZATION ON DATABASE::ReportsDB TO sa;
GO
USE ReportsDB;
CREATE USER Bob;
GO
CREATE VIEW Sales AS SELECT * FROM SalesDB..Sales;
GO
GRANT SELECT ON Sales TO Bob
GO

--test permissions
EXECUTE AS login = 'Bob'
GO
SELECT * FROM Sales --this should succeed
GO
SELECT * FROM SalesDB..Sales --this should fail
GO
REVERT
GO

/*
-- CLEAN UP
USE master
DROP DATABASE SalesDB;
DROP DATABASE ReportsDB;
DROP LOGIN Bob;
*/


--
Hope this s.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"Warren" <Warren @discussions.microsoft.com> wrote in message
news:A61B0C64-1E71-4253-9925-370E586F0D74@microsoft.com...
> OK you were able to get it going; but HOW?
> I have gone through all the same scenario and can't get this working.
>
>
>
> "Dan Guzman" wrote:
>
>> I'm glad you were able to get it going.
>>
>> --
>> Dan Guzman
>> SQL Server MVP
>> http://weblogs.sqlteam.com/dang/
>>
>> "chumshack" <sqlrunner@gmail.com> wrote in message
>> news:f9cc20a1-f493-4750-a95f-c183bc3c411e@8g2000hse.googlegroups.com...
>> On May 22, 8:29 am, chumshack <sqlrun...@gmail.com> wrote:
>> > On May 21, 8:52 pm, "Dan Guzman" <guzma...@nospam-
>> >
>> >
>> >
>> >
>> >
>> > online.sbcglobal.net> wrote:
>> > > > I have read every article I can find on this topic and I cannot see
>> > > > why this is failing. The databases are both owned by SA and both
>> > > > the
>> > > > table and view are created using the dbo schema and are therefor
>> > > > owned
>> > > > by dbo. I have granted select permission on the view, TheView, to
>> > > > AppUser. My guess is that somewhere along the way the chain is
>> > > > being
>> > > > broken. Does anyone have any ideas what is failing? I do understand
>> > > > that I can simply add AppUser to the CentralDB, but the purpose of
>> > > > this set-up was to have applications be self-contained and restrict
>> > > > access to CentralDB.
>> >
>> > > A user must have a security context in order to access a database. If
>> > > you
>> > > don't want to add the user to CentralDB, you can enable the guest
>> > > user
>> > > instead. No permissions need to be granted on the table in either
>> > > case.
>> >
>> > > --
>> > > Hope this s.
>> >
>> > > Dan Guzman
>> > > SQL Server MVPhttp://weblogs.sqlteam.com/dang/
>> >
>> > > "chumshack" <sqlrun...@gmail.com> wrote in message
>> >
>> > >news:4b075fbf-c55f-4de9-8bad-0c783f293d02@m44g2000hsc.googlegroups.com...
>> >
>> > > >I am trying to set-up the following scenario: We have a centralized
>> > > > set of databases with access restricted to a select few. Let's call
>> > > > one of those databases CentralDB. We have many applications that
>> > > > will
>> > > > access this data in a read only manner and to keep the applications
>> > > > separate from one another we place them in their own databases.
>> > > > Let's
>> > > > call one ApplicationB. Both databases have had theirownership
>> > > > changed to 'sa' and they both have 'dbchaining' enabled. I have a
>> > > > table within the CentralDB, AllData, which was created under the
>> > > > dbo
>> > > > schema and looks like this: dbo.AllData. A view was created in the
>> > > > ApplicationB database, under the dbo schema and looks like this:
>> > > > dbo.TheView. The view structure is as follows:
>> >
>> > > > Create View [dbo].[TheView]
>> > > > (Name)
>> > > > as
>> > > > select col1
>> > > > from CentralDB.dbo.AllData
>> >
>> > > > Within the ApplicationB database I have a user, AppUser, which is a
>> > > > sql server authenticated login and exists with
>> > > > data_reader/data_writer
>> > > > permission in ApplicationB database only. I grant select on TheView
>> > > > to AppUser. When I try to run the select I get the following error:
>> >
>> > > > Msg 916, Level 14, State 1, Line 1
>> > > > The server principal "AppUser" is not able to access the database
>> > > > "CentralDB" under the current security context.
>> >
>> > > > I have read every article I can find on this topic and I cannot see
>> > > > why this is failing. The databases are both owned by SA and both
>> > > > the
>> > > > table and view are created using the dbo schema and are therefor
>> > > > owned
>> > > > by dbo. I have granted select permission on the view, TheView, to
>> > > > AppUser. My guess is that somewhere along the way the chain is
>> > > > being
>> > > > broken. Does anyone have any ideas what is failing? I do understand
>> > > > that I can simply add AppUser to the CentralDB, but the purpose of
>> > > > this set-up was to have applications be self-contained and restrict
>> > > > access to CentralDB.
>> >
>> > > > Thanks,
>> > > > Josef- Hide quoted text -
>> >
>> > > - Show quoted text -
>> >
>> > The guest user does exist within the CentralDB, so the question I have
>> > now is how to I link the user, and all users outside of CentralDB, to
>> > use the guest user account when moving between databases?- Hide quoted
>> > text -
>> >
>> > - Show quoted text -

>>
>> NVM, I got it thank you for the Dan, it fixed the issue.
>>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,35505 seconds with 17 queries