Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Location
    somewhere in dbforums
    Posts
    221

    Unanswered: query table in different database

    suppose i have databases DB1 and DB2 on the same server. Now i connect to DB2 using db2connect. Now how can i query tables of DB1????.

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You can either use a distributed transaction, for example via XA, or you use DB2's federated capabalities.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    May 2007
    Location
    somewhere in dbforums
    Posts
    221
    well can you give me an example using distributed transactions..........i mean like just a small piece of code.....or can u just redirect me to some place where it is available...i mean code....also i am writing a stored procedure which spans two databases on the same server....and i have to manipulate with the data present in these tables....
    Last edited by nick.ncs; 05-08-07 at 09:01.

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I believe that type 2 connections are extensively documented in the DB2 manuals. I don't know which additional information you may need for those. Also, we have no idea about your application and programming language.

    If you are inside a stored procedure, your only option in federation. Federation already comes with the necessary infrastructure for distributed transactions, i.e. it performs two-phase commit itself and DB2 acts as a transaction manager in that case.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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