If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Queries accross two DB's

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 00:48
sbas sbas is offline
Registered User
 
Join Date: Aug 2003
Location: London
Posts: 25
Queries accross two DB's

DB2 Ver 8.

Can we build Queries across two Databases. For ex : on two diff tables existing in two diff DB's.

Table P1 in DB test1 and Table P2 in DB Test2. ?

If so how ?

I know of Federated DB's, but wondering is there any other way ?

Thanks in advance,
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 01:14
sbas sbas is offline
Registered User
 
Join Date: Aug 2003
Location: London
Posts: 25
Information which need to passed to the above ..

This two db's on the Same platform. Win Platform..
Reply With Quote
  #3 (permalink)  
Old 04-14-04, 01:17
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
If the two tables referenced are in the same SQL statement, you need federated support.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 04-14-04, 01:30
sbas sbas is offline
Registered User
 
Join Date: Aug 2003
Location: London
Posts: 25
Thanks Marcus for the prompt reply..Am wondering is there anything other then federated DB support..like using alias can we build a query based on two different db's.




Quote:
Originally posted by Marcus_A
If the two tables referenced are in the same SQL statement, you need federated support.
Reply With Quote
  #5 (permalink)  
Old 04-14-04, 01:36
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
No, not if the two tables are in the same SQL statement. However, one can connect to two different databases in the same program, but you would need separate SQL statements to access them.

When there is any chance that tables might need to be accessed in the same SQL statement, they should be in the same database, but perhaps different schemas if they need to be logically separated. Having two databases active on the same machine at the same time is not very efficient because it limits the amount of memory that can be used by any one database.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 04-14-04 at 01:44.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On