Re: Impossible to use a view of a table from another database



Mike (Mike@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I have two database on the same server. Database A and datadase B. I am
using sql server for the databases and Microsoft Access as my front
end.

I create a view in database A to see a table in database B.
no problem here.
I run the view in the query analyser (Database A)
no problem here

My problem start when I try to run the same query as a pass-trought query
inside Microsoft access.

If I run the pass-trought query as being the database owner of both
database it work.

But as soon as I try to use the same pass-trought query as another user (A
user with select, write, update, and delete permission on the view in
database A or even with permission on the table in database B) I get the
messge in Microsoft Access (Invalide object name). Even if I have the
permission to select the view, Microsoft Access is not able to see or make
the link to that view.

I don't have any problem with any other views, only the views that refer
to table in another database on the same server.

Do some one know why SQL server don't let My front end see that view, even
if I gived the permission for that user to select that view.

Since you mention Query Analyzer, I assume in SQL 2000.

The mechanism at hand here is ownership chaining. With ownership
chaining, you can grant permission on a view without granting
access on the underlying tables, as long as the view and table
owners are the same.

Up to SQL 2000 SP2 this also work across databases. That is, if both
databases had the same owner, and the same login mapped to the same
database user. A simple case: the databases were both owned by sa, and
all objects were owned by dbo.

In SQL 2000 SP3, Microsoft changed this, so that by default database
chaining is disabled, because there are security issues with it on a
server where the DBA does not have control over all databases.

To enabled DB chainging, you need to do:

sp_configure 'Cross DB Ownership Chaining', 1
RECONFIGURE
go
exec sp_dboption firstdb, 'db chaining', true
exec sp_dboption seconddb, 'db chaining', true

But do not do this, unless you have full control over the server.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Theres a new Borland Delphi directions survey up
    ... Choosing and Using MSDE 2000 as the Database Engine for Your Application ... The Microsoft SQL Server 2000 Desktop Engine is an alternative ... database engine in Microsoft Access 2002 which enables software developers ...
    (borland.public.delphi.non-technical)
  • Re: Multiuser Interface on shared servicer with SQL Backend
    ... I agree with Tony that this doesn't look like a SQL Server issue at ... The database has been placed in a state by user 'Admin' on machine [computer ... file present in the same folder as the FE MDB/MDE with the same name. ... Tony Toews, Microsoft Access MVP ...
    (microsoft.public.access.modulesdaovba)
  • Re: Multiuser Interface on shared servicer with SQL Backend
    ... front-end, and that they have only ONE intance of it open on their pc. ... I agree with Tony that this doesn't look like a SQL Server issue at ... The database has been placed in a state by user 'Admin' on machine [computer ... Tony Toews, Microsoft Access MVP ...
    (microsoft.public.access.modulesdaovba)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)