Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    2

    Talking Unanswered: 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.

  2. #2
    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

  3. #3
    Join Date
    Jul 2004
    Posts
    76
    Mujeeb,

    Could you please provide some more input on that?

    Thanks,
    Jai

  4. #4
    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

  5. #5
    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....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •