Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 654F39FBBE1 for ; Thu, 7 Jun 2007 11:34:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 98778-03 for ; Thu, 7 Jun 2007 11:34:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web31814.mail.mud.yahoo.com (web31814.mail.mud.yahoo.com [68.142.206.167]) by postgresql.org (Postfix) with SMTP id DC68D9FB43C for ; Thu, 7 Jun 2007 11:34:11 -0300 (ADT) Received: (qmail 53759 invoked by uid 60001); 7 Jun 2007 14:34:10 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=rMEK6BNu2JVcI1986h1YrP7t38VXXmotjVbboo2DHDNcs+CCRyvmzvm5EigLF3WTfQ8+RBl35YNNKarpYTd2Cs9ZhMK0oiPP/wUa+jqwlVXp9VClN4aVyBd7iub2SBvxn85h0iHMeTbN8WW6Qh6n/TNjqr8NZMJYs8KS4nzIA0c=; X-YMail-OSG: ny3exSoVM1kXhnD.kP6R4p5g.kGiudG5dM39s0baSiibq40nIqmMFtyRKyynE5j8xfx7qZn7YlQK2mdKBmJegE4VERlrhY0199Nc3E0fbCkEDYc- Received: from [63.203.180.122] by web31814.mail.mud.yahoo.com via HTTP; Thu, 07 Jun 2007 07:34:10 PDT Date: Thu, 7 Jun 2007 07:34:10 -0700 (PDT) From: Richard Broersma Jr Subject: Re: Query with tables from 2 different databases in Java To: Mark Lewis , Loredana Curugiu Cc: pgsql-jdbc@postgresql.org, pgsql-novice@postgresql.org In-Reply-To: <1181225634.31471.387.camel@archimedes> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <162676.53375.qm@web31814.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.125 tagged_above=0 required=5 tests=AWL=-1.231, BAYES_50=0.001, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447 X-Spam-Level: ** X-Archive-Number: 200706/27 X-Sequence-Number: 17089 --- Mark Lewis wrote: > On Thu, 2007-06-07 at 17:08 +0300, Loredana Curugiu wrote: > > Hi, > > > > I need a query to use tables from 2 different databases and > > that query to be executed from a .java file. What do you recommand? > > > > Thanks in advance! > > > > > > Regards, > > Loredana > > > > > Move the data to a single database, or else perform the query manually > by pulling back the matching results from each database individually and > then stitching them together. if the two databases are part of the same cluster you can use DBLINK so that one database can see the table of enterest from the other. http://pgfoundry.org/projects/snapshot/ if the two databases are not contained in the same cluster you can use DBI-LINK. http://pgfoundry.org/projects/dbi-link/ Then from java, you only have to perform a simple query from one database. Regards, Richard Broersma Jr.