Re: Is there a way to Use an Application Role with more than one database?
- From: "Dan Guzman" <guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Dec 2006 20:46:52 -0600
So you are still getting the 'is not a valid user in database' error? Did you enable the guest user? i.e.:
USE ProductionDB
EXEC sp_adduser 'guest'
I've double checked everything. (Presumable I shouldn't remove guest permissions to systems objects in the ProductionDB?)
You shouldn't need to grant or revoke guest permissions. The only purpose of guest in this case is to provide a default security context. System object permissions will be inherited from the public role.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Clive" <clive.elsworth@xxxxxxxxxxxxxxxxx> wrote in message news:eTcBhiIGHHA.1188@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for that Dan, however:
I'm still getting the same error message when using the app role on the Dev DB.
I've double checked everything. (Presumable I shouldn't remove guest permissions to systems objects in the ProductionDB?)
It's not a major deal at the moment because I'm just volume testing, however it would be good to know if its possible to continue using app roles when a system accesses more than one DB.
If you can offer anything else I'll try it. If not I'll leave it for now.
Thanks again, Clive
"Dan Guzman" <guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:101BB10D-713C-4826-8542-D2485A5D2DB4@xxxxxxxxxxxxxxxxHowever when testing the app I get the error: "Server User '<servername>\<dbusername>' is not a valid user in database <separate DB>"
One of the drawbacks to application roles is that the security context is valid only in the database in which the role was activated. All other databases are accessed as the guest user.
Can anyone provide any pointers or tips on this? (Apart from moving the big table to the Development DB)
If your UNION ALL query is encapsulated in a view or stored procedure, you can address your security requirement with cross-database ownership chaining. However, due to the security issues with development and production on the same box, I suggest you consider cross-database chaining only if sysadmin role members are the only users that can create dbo-owned objects. See the Books Online for more information on cross-database chaining.
Assuming your objects are owned by dbo, you can enable cross-database chaining as follows:
1) enable 'db chaining' in both databases:
EXEC sp_dboption 'DevelopmentDB', 'db chaining', true
EXEC sp_dboption 'ProductionDB', 'db chaining', true
2) Ensure both databases are owned by the same login (so the 'dbo' user ownership chain is unbroken):
USE DevelopmentDB
EXEC sp_changedbowner 'OwnerLogin'
USE ProductionDB
EXEC sp_changedbowner 'OwnerLogin'
3) Enable the guest user in the ProductionDB
EXEC sp_adduser 'guest'
Importantly, make sure no permissions are granted to guest or public in the production database.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Clive" <clive.elsworth@xxxxxxxxxxxxxxxxx> wrote in message news:uje4MqFGHHA.3268@xxxxxxxxxxxxxxxxxxxxxxxI've been using App Roles very successfully since SQL 7, but now I'm doing a volume test (with SQL 2000) and have Unioned two tables together - one big one which is in a separate DB, whilst the other one - and everything else - is still in the Development DB.
However when testing the app I get the error: "Server User '<servername>\<dbusername>' is not a valid user in database <separate DB>"
This is despite the fact that a user of the same name exists in both DBs. The only way I find I can test the app is go back to the old fashioned (and more complex) security model.
Can anyone provide any pointers or tips on this? (Apart from moving the big table to the Development DB)
Any help much appreciated.
Thank you
Clive (London UK)
.
- Follow-Ups:
- References:
- Prev by Date: Re: DB Chaining, Guest Account, 2000 backup restored in Sql 2005
- Next by Date: Re: SQL2000 UserPermissions for Database
- Previous by thread: Re: Is there a way to Use an Application Role with more than one database?
- Next by thread: Re: Is there a way to Use an Application Role with more than one database?
- Index(es):
Relevant Pages
|
|