We help IT Professionals succeed at work.

merging 2 mysql databases with java

jazzIIIlove
jazzIIIlove asked
on
161 Views
Last Modified: 2016-07-29
Hi,

I need to merge 2 mysql databases with java or python.

The databases are exactly the same in schema but data is different.

in terms of the query which i need to pass in java or python. Anything i should care about?

Would it be the case that i need to insert data to the table having foreign key first?

what is the strategy?

Br.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
I don't think there's a 'simple' way to do it. It's just a question of putting the work in
CERTIFIED EXPERT

Author

Commented:
Hi,

But any approach you suggest?

Br.
CERTIFIED EXPERT
Top Expert 2016

Commented:
You need to issue a series of queries for each and every table
CERTIFIED EXPERT

Author

Commented:
Should i do this e.g
A) Table 2 fk (source): insert into Table 2' fk (target)

B) Table 1 pk (source): insert into Table 1' pk (target)

Should i do in this order (A, B)

Fk: foreign key, Pk: primary key

Prime tables are the tables that will have the merged data
CERTIFIED EXPERT
Top Expert 2016

Commented:
Foreign keys would be a consideration if you are going to get referential integrity violations, yes. In that case, you need to do them in an order that doesn't cause violations
CERTIFIED EXPERT

Author

Commented:
Do you think my above order is correct?
CERTIFIED EXPERT
Top Expert 2016
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.