Link to home
Start Free TrialLog in
Avatar of amp834
amp834

asked on

Combine SQL (Derby) databases

I have several (Derby) databases with the same structure (populated by different machines), and want to combine them into one large database (using Java programming).  The tables like tClient, tTransaction, etc. in each database have records that the other databases don't contain.

What are some fast ways of combining the databases into one large database "in a bulk fashion"?

Once I have a large database B and a little database L comes along later, I would like to write all of L's data into B.

I am comparing this "several-databases separately" with using a client-server version of Derby (several databases, each machine can work independently using its own fast resources; client-server, each machine writes to a centralized derby database)


Any and all tips and tricks would be appreciated, I will split the points between all the useful answers.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amp834
amp834

ASKER

Another way to ask the question:  If I'm populating a database with a million records (say, from a CSV file or any format that would make it fast), how should it be done?
The way i'd do it is to use exactly the method i posted
Avatar of amp834

ASKER

If you're populating a table for the first time, for example, you may remove all (or most) of the indexes, populate the table, and then add the indexes.  It's also tips and tricks like this I was looking for, that's why I also posted to the general database topic, and not just the java topic.  

I wanted to hear from people who actually do things like this.  Do you think I should submit the question differently?
>>remove... indexes, populate the table, and then add the indexes.

You could do that, but bear in mind that if there are duplicates, you will need to write another query to find them, as you won't be *able* to add the indexes
Avatar of amp834

ASKER

I was just using an example (and that's why I added "Most indexes")

I was more interested in...
>I wanted to hear from people who actually do things like this.  Do you think I should submit the question differently?
>>Do you think I should submit the question differently?

Not really: there are not many options if you want to do it in Java
getting rid of indexes is a good idea
generally simpler to do it with a database import tool or script instead of using java
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of amp834

ASKER

This looks promising.
Avatar of amp834

ASKER

Thanks for your help and comments.  I am finally getting around to closing some of the questions I asked!