Re: Query with tables from 2 different databases in Java

From: "Julius Stroffek" <julo(at)stroffek(dot)net>
To: "Mark Lewis" <mark(dot)lewis(at)mir3(dot)com>
Cc: "Loredana Curugiu" <loredana(dot)curugiu(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: Query with tables from 2 different databases in Java
Date: 2007-06-08 08:18:55
Message-ID: 6ec50dfd0706080118u794797e9y4c21cb0d813da3ac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-novice

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(dot)lewis(at)mir3(dot)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
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bart Degryse 2007-06-08 08:29:26 Re: [NOVICE] Query with tables from 2 different databasesinJava
Previous Message Srinivas Kotapally 2007-06-07 22:21:58 Intermittent Connection problems using JDBC

Browse pgsql-novice by date

  From Date Subject
Next Message Bart Degryse 2007-06-08 08:29:26 Re: [NOVICE] Query with tables from 2 different databasesinJava
Previous Message Andrew Maclean 2007-06-08 04:11:40 How do I ensure a value does not exist in a column.