pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Data Migration
2+ messages / 2 participants
[nested] [flat]

* Data Migration
@ 2007-09-03 08:52  Rob Kirkbride <rob.kirkbride@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Rob Kirkbride @ 2007-09-03 08:52 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

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.

Any ideas?

Thanks

Rob

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Data Migration
@ 2007-09-03 11:34  Heikki Linnakangas <heikki@enterprisedb.com>
  parent: Rob Kirkbride <rob.kirkbride@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2007-09-03 11:34 UTC (permalink / raw)
  To: Rob Kirkbride <rob.kirkbride@gmail.com>; +Cc: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-09-03 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-03 08:52 Data Migration Rob Kirkbride <rob.kirkbride@gmail.com>
2007-09-03 11:34 ` Heikki Linnakangas <heikki@enterprisedb.com>

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