From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Rob Kirkbride <rob.kirkbride@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Data Migration
Date: Mon, 03 Sep 2007 12:34:57 +0100
Message-ID: <46DBF161.8050701@enterprisedb.com> (raw)
In-Reply-To: <e0b3cb2b0709030152j325b68edsaf0701287ddc2004@mail.gmail.com>
References: <e0b3cb2b0709030152j325b68edsaf0701287ddc2004@mail.gmail.com>
Rob Kirkbride wrote:
> Is there a way in JDBC to move data from one database to another without
> having to hard-wire the table structure?
>
> I was wondering if I can do a kind of
>
> ResultSet rs = executeStatement("select * from table (from connection 1)
> where somecondition")
> while (rs.next())
> take the resultset and then pass directly into a prepared statement for
> an "insert into table" (from connection 2)
>
> I can't see any way other disecting the values from the first query and
> using getSQLType.
That seems like the easiest solution to me. You can do it completely
dynamically with no hard-wired table structure using the metadata.
Perhaps you could do it with the JDBC 4 RowSet API? I haven't looked at
it in detail.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: heikki@enterprisedb.com, rob.kirkbride@gmail.com
Subject: Re: Data Migration
In-Reply-To: <46DBF161.8050701@enterprisedb.com>
References: <e0b3cb2b0709030152j325b68edsaf0701287ddc2004@mail.gmail.com> <46DBF161.8050701@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox