Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008

    Red face Unanswered: one query to access multiple database on DB2 Instance


    I am new to DB2 and I am having this one simple query :-

    How do I access the two different databases defined in same DB2 Instance using a single query?

    I have 2 Databases DB2Member and DB2CLaims.
    Table Membership in DB2Memeber database and
    Table Claim_dtl in DB2Claims database.
    Both Databases are running on same DB2 Instance.

    Now I wanted to run a query which will get me the Membership info for all
    members and Claimdtl info associated with those members.

    I suppose SQL would be something like:-
    Select A.MemberName, A.MemStatus, B.MemClaimDt, B.MemClaimAmt
    From DB2Member.Membership as A, DB2Claims.Claim_dtl as B
    Where A.MemID = B.MemID

    Now I want to know, how do I do this in DB2?
    I have heard of something call federation which allows querying multiple heterogenic databases e.g. Oracle, DB2 etc. Do I have to use this service? If yes , than how?

    Thanks a lot in advance for your time and help.

    With Cheers,

  2. #2
    Join Date
    May 2003
    You would need to activate the database for Federated support , and then create alias' and wrappers on one of the databases (where the SQL runs) that references the other database.

    See the Federated manual for details or google "db2 federated"
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jan 2007
    Jena, Germany
    Another option to consider is not using separate databases but rather different schemas.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  4. #4
    Join Date
    Apr 2008


    Database tables are already existing, so restructuring is not an option right now.
    I think federation would do the trick for me.
    Thanks a lot guys for quick reply.

Posting Permissions

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