views:

50

answers:

1

I'm using JAVA DB (derby)

I want to import a public view of my data to another database (also in java db).

I want to pass this data and save in to the other database. I'm having trouble since the general rule is one connection to one database.

Help would be much appreciated.

A: 

You need two connections, one to each database.

If you want the two operations to be a single unit of work, you should use XA JDBC drivers so you can do two-phase commit. You'll also need a JTA transaction manager.

This is easy to do with Spring.

SELECT from one connection; INSERT into the other. Just standard JDBC is what I'm thinking. You'll want to batch your INSERTs and checkpoint them if you have a lot of rows so you don't build up a huge rollback segment.

I'd wonder why you have to duplicate data this way. "Don't Repeat Yourself" would be a good argument against it. Why do you think you need it in two places like this?

duffymo
Can you elaborate on that? I established two separate connections for the two databases. I want to import the public view of one to the other. can you give me a source to look in. thanks man
Ron