Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 58B189FB6C2 for ; Fri, 8 Jun 2007 05:19:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 03105-08-2 for ; Fri, 8 Jun 2007 05:18:56 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.181]) by postgresql.org (Postfix) with ESMTP id 0A0739FC17E for ; Fri, 8 Jun 2007 05:18:57 -0300 (ADT) Received: by wa-out-1112.google.com with SMTP id k40so1125785wah for ; Fri, 08 Jun 2007 01:18:55 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=iOkt5gXTCVxykJhvZuxOoBhTzcucTExYEk6kpM4+o/ngORDQIIGrXCMXgu+6+f4FU4AbGzXhlQcbfI4pxUTh49uwGW4mKvrlGkAiUUMOe9OPVzh5TO7J5Q9eoc5XiDgPjNas0NHEvwpDHPVXZ/Fahn/N7MYZqdzmPbDpCkYR1eQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=DZICK8qkER+aa4lPrf3vzWsLIIKFF5Ko9Jym/Ic4P82dHlaNKWQbiJSqlVutFwWDSmD0S/HPUNz/7RsCE1St4ahymHyj8MWLf8GeFqt5H/Mvp1SA1BLce43v5q0gG/jmiMlljOI14x79SpwNUs36zqlZphcdMFlT8o9loxVVvlQ= Received: by 10.115.94.1 with SMTP id w1mr2365656wal.1181290735407; Fri, 08 Jun 2007 01:18:55 -0700 (PDT) Received: by 10.114.235.4 with HTTP; Fri, 8 Jun 2007 01:18:55 -0700 (PDT) Message-ID: <6ec50dfd0706080118u794797e9y4c21cb0d813da3ac@mail.gmail.com> Date: Fri, 8 Jun 2007 10:18:55 +0200 From: "Julius Stroffek" To: "Mark Lewis" Subject: Re: Query with tables from 2 different databases in Java Cc: "Loredana Curugiu" , pgsql-jdbc@postgresql.org, pgsql-novice@postgresql.org In-Reply-To: <1181225634.31471.387.camel@archimedes> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_78095_20845060.1181290735368" References: <1c23c8e70706070708m2f3be6f9o75571fd8a82ee390@mail.gmail.com> <1181225634.31471.387.camel@archimedes> X-Google-Sender-Auth: 3ed172cd4ebc2c32 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/33 X-Sequence-Number: 17095 ------=_Part_78095_20845060.1181290735368 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Mark, You can use JTA - Java Transaction API to encapsulate transaction atomicity across different databases (and database vendors). XADatasource, XAConnection, XAResource are objects you should be looking for. A couple of links about the issue: http://java.sun.com/products/jta/ http://java.sun.com/developer/EJTechTips/2005/tt0125.html#1 http://www.java-tips.org/java-ee-tips/enterprise-java-beans/introduction-to-the-java-transactio.html However, I do not know how postgres sql driver implements those interfaces. Regards, Julius Stroffek On 6/7/07, 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. > > -- Mark Lewis > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > ------=_Part_78095_20845060.1181290735368 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Mark,

You can use JTA - Java Transaction API to encapsulate transaction atomicity across different databases (and database vendors).

XADatasource, XAConnection, XAResource are objects you should be looking for. A couple of links about the issue:

http://java.sun.com/products/jta/
http://java.sun.com/developer/EJTechTips/2005/tt0125.html#1
http://www.java-tips.org/java-ee-tips/enterprise-java-beans/introduction-to-the-java-transactio.html

However, I do not know how postgres sql driver implements those interfaces.

Regards,

Julius Stroffek

On 6/7/07, Mark Lewis < mark.lewis@mir3.com> 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.

-- Mark Lewis

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

------=_Part_78095_20845060.1181290735368--