Re: Joining tables from two databases
- From: T McDonald <TMcDonald@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 06:40:05 -0800
There are two different web accounts. In this case I can't have the same web
account with rights to both tables. Would there be some way to perhaps read
data from both tables into the application as DataTables and then do the
select command against the results? Or some other way to use both web
accounts?
Thanks for the help
"William (Bill) Vaughn" wrote:
If both databases are on the same server (and the web account has rights to.
both) you can simply reference the database table using the syntax:
databasename.tablename.owner.column
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"T McDonald" <TMcDonald@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:92A0B035-8D36-4302-9353-C88AF5C5DB0D@xxxxxxxxxxxxxxxx
Both are SQL Server databases on the same server. This is an asp.net
application, each database has it's own accounts.
I'm not really following how you are solving it using a service account.
As I understand, to create a connection I need to use a connection string
that indicates the db and credentials I'm using. If I have more than one
db,
how would I connect to both in order to run a select statement over both
databases.
"Sundar Narasiman" wrote:
T McDonald,
I would like to know the following
1. Are these 2 databases are SQL Server ?
2. Are these 2 databases living in the same instance of SQL Server ?
You should not connect to these two databases using Web User Name and
Password. This is not the recommended approach.
Your data-access code (assembly) should be living in the
middle tier of the Server Farm. You should setup a SERVICE ACCOUNT to
access
the data from these 2 databases. The SERVICE ACCOUNT should have enough
privileges on those 2 databases.
--
Thanks & Regards,
Sundar Narasiman
"T McDonald" wrote:
I am having trouble figuring out how I might do the following, if I can
do it
at all. I have two databases, each with their own separate
authentication
details.
I have a select statement that gets the data from one table based on
existence in another table in another database. This works fine when
using
the windows authentication. What I don't understand how to do, is to
connect
to both databases in a web project where it is using the webuser name
and
password. Could someone steer me in the right direction on doing this.
I hope my explanation is somewhat clear.
Thanks
- Follow-Ups:
- Re: Joining tables from two databases
- From: William \(Bill\) Vaughn
- Re: Joining tables from two databases
- References:
- Re: Joining tables from two databases
- From: William \(Bill\) Vaughn
- Re: Joining tables from two databases
- Prev by Date: Re: SqlCommand.Cancel and Transactions
- Next by Date: Re: SqlCommand.Cancel and Transactions
- Previous by thread: Re: Joining tables from two databases
- Next by thread: Re: Joining tables from two databases
- Index(es):
Relevant Pages
|