Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2004
    Posts
    33

    Question Unanswered: DB2 -- how to query if using 2 different databases

    I have 2 databases one is called “E” and one is called “S”. In database E, I have a table called “Employee” and in database “S”, I have a table called “Event”. I need to get FName and Lname from database E, table Employee. How can I do the query? Appreciate it. Thanks a lot.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Look into "Federation". This will make it appear that the tables of one database are part of another. You can then do normal SQL including joins on tables in the different actual DBs.

    HTH

    Andy

  3. #3
    Join Date
    Apr 2004
    Posts
    33

    Question DB2 - Federation

    Quote Originally Posted by ARWinner
    Look into "Federation". This will make it appear that the tables of one database are part of another. You can then do normal SQL including joins on tables in the different actual DBs.

    HTH

    Andy
    Andy,

    This for your reply.

    Is this something that the DBA has to do it at the server site or something that i can do as in my own PC (developement site)???? Thanks.

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The DBA has to set it up on the servers.

    Andy

  5. #5
    Join Date
    Apr 2004
    Posts
    33

    Question

    Quote Originally Posted by ARWinner
    The DBA has to set it up on the servers.

    Andy
    The two or more databases are under the same server (just has more than one databases to seperate each big application). Is the method still the same thing?????? I have just read some about "Federation", they talk more about databases in many different servers (db2, oracle, and etc). Thanks.

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    It does not matter if the databases are on the same server or different server, the only way to access both dbs in a single SQL is through Federation.

    Andy

  7. #7
    Join Date
    Apr 2004
    Posts
    33
    Quote Originally Posted by ARWinner
    It does not matter if the databases are on the same server or different server, the only way to access both dbs in a single SQL is through Federation.

    Andy
    Thanks Andy. It helps a lot. At least I know now where to search more information.

  8. #8
    Join Date
    Nov 2004
    Posts
    374

    federated

    in short :
    db2 update dbm cfg using federated yes
    db2 create wrapper db2drda
    db2 create server mapping xxx .....
    db2 create user mapping for server xxxx
    db2 create nickname schema1.name1 for db1.schema1.name1
    db2 select * from schema1.name1 : as for a local table
    Best Regards, Guy Przytula
    Best Regards, Guy Przytula
    DB2/ORA/SQL Services
    DB2 DBA & Advanced DBA Certified
    DB2 Dprop Certified
    http://users.skynet.be/przytula/dbss.html

Posting Permissions

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