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 > Help!! Cross database joining

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-17-05, 08:26
act7656 act7656 is offline
Registered User
 
Join Date: Mar 2004
Posts: 24
Unhappy Help!! Cross database joining

Guys/Gals,

Please help !!! i want to use table A in DataBase 123 (DB123)join with table B in Database 456 (DB456), how can i do that?

First, i tot i can create a view in Database 123 like this :

CREATE VIEW Test_view AS
SELECT *
FROM DB456.TABLE_B

but i give me "<eb1>SQL0204N "DB456.TABLE_B" is an undefined name. SQLSTATE=42704"

any others way i can use without copying any table across DB coz i am not allowed to do so.

Please help!!
__________________
Hello
Reply With Quote
  #2 (permalink)  
Old 02-17-05, 09:11
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Assuming you are on db2 luw ..

Look into the federated database concepts ..

a sample set of SQL

create server sampsrv1 type db2/6000
version 8.2 wrapper drda
authorization "user1" password "pass1"
options(
dbname 'sam')

@

create user mapping for USER server sampsrv1 options
(remote_authid 'user1', remote_password 'pass1')
@

create nickname a.systables for sampsrv1.syscat.tables @

select * from a.systables @
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 02-17-05, 09:38
act7656 act7656 is offline
Registered User
 
Join Date: Mar 2004
Posts: 24
HI sathyaram_s,

Thanks for your fast reply, i am using DB2 UDB 7.2 for Windows, after look at your sample SQL , not really understand, can you please explain further?? thanks ..

act7656
__________________
Hello
Reply With Quote
  #4 (permalink)  
Old 02-17-05, 09:51
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Have you had a chance to look at the manuals ??
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 02-17-05, 11:33
udbraja udbraja is offline
Registered User
 
Join Date: Sep 2004
Posts: 111
Look in to online redbook links for Information Integrator or DB2 Manual pages
for federated db settings.

Here is the four steps involved for this setup.
1, Create wrapper
2. Create server
3. Create user mappings
4. Create nicknames

http://publib-b.boulder.ibm.com/Redb...7052.html?Open

Thanks,
Raj
Reply With Quote
  #6 (permalink)  
Old 02-20-05, 03:39
act7656 act7656 is offline
Registered User
 
Join Date: Mar 2004
Posts: 24
If let say the 2 different database is also resides in the same server in DB2 UDB 7.2, can i have a faster way to join this 2 table instead of appy the federated databse concept?

Please comment, thanks .
__________________
Hello
Reply With Quote
  #7 (permalink)  
Old 02-20-05, 11:45
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
No, you still 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
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