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 > connect different database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-05, 04:05
panacie panacie is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
Talking connect different database

Hi,

Does anyone know how to connect two different database in same catalogue.

for example i have the instance name "db2inst1" and i use it to create two database named "DB1" and "DB2";
however, my program need to search the data from both database.

so how to connect both of them?

thanks a lot.
Reply With Quote
  #2 (permalink)  
Old 10-17-05, 10:38
bmujeeb bmujeeb is offline
Registered User
 
Join Date: Mar 2004
Posts: 448
You can use

1. using set client with type 2 //information in the command reference.

2. You can use federated database.

You can also do that in java.

regards,

mujeeb
Reply With Quote
  #3 (permalink)  
Old 10-19-05, 13:27
jsp2999 jsp2999 is offline
Registered User
 
Join Date: Jul 2004
Posts: 76
Mujeeb,

Could you please provide some more input on that?

Thanks,
Jai
Reply With Quote
  #4 (permalink)  
Old 10-19-05, 16:24
bmujeeb bmujeeb is offline
Registered User
 
Join Date: Mar 2004
Posts: 448
for type 2 connect.


db2 => set client connect 2 disconnect explicit sqlrules std
DB20000I The SET CLIENT command completed successfully.
db2 => connect to sample

Database Connection Information

Database server = DB2/NT 8.2.3
SQL authorization ID = BMUJEEB
Local database alias = SAMPLE

db2 => select count(*) from employee

1
-----------
32

1 record(s) selected.

db2 => connect to dbmon

Database Connection Information

Database server = DB2/NT 8.2.3
SQL authorization ID = BMUJEEB
Local database alias = DBMON

db2 => select count(*) from syscat.tables

1
-----------
424

1 record(s) selected.

db2 => query client

The current connection settings of the application process are:

CONNECT = 2
DISCONNECT = EXPLICIT
MAX_NETBIOS_CONNECTIONS = 1
SQLRULES = STD
SYNCPOINT = ONEPHASE
CONNECT_DBPARTITIONNUM = -1
ATTACH_DBPARTITIONNUM = -1

db2 => set connection sample

Database Connection Information

Database server = DB2/NT 8.2.3
SQL authorization ID = BMUJEEB
Local database alias = SAMPLE

db2 => select count(*) from employee

1
-----------
32

1 record(s) selected.


check this link


http://publib.boulder.ibm.com/infoce...n/r0000908.htm


regards,

mujeeb
Reply With Quote
  #5 (permalink)  
Old 10-19-05, 21:17
panacie panacie is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
Talking

thanks....i have tried the federated database...and it works...when got time i'll try another method 1 ...thanks a lot....
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