Solved

merging 2 mysql databases with java

Posted on 2016-07-15
7
58 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.
0
Comment
Question by:jazzIIIlove
  • 4
  • 3
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 41713247
This expert suggested creating a Gigs project.
I don't think there's a 'simple' way to do it. It's just a question of putting the work in
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 41725070
Hi,

But any approach you suggest?

Br.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41725089
You need to issue a series of queries for each and every table
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 12

Author Comment

by:jazzIIIlove
ID: 41725251
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41725420
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
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 41726628
Do you think my above order is correct?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 41726652
I'm not sure if i understand your notation but the general principle is that the table with a foreign key must be done after the table to which it refers (i.e. the one that contains that key)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
understanding output of mysql version 2 50
SQL inner join confusion 15 42
selecting date modified field from a table 2 39
factorial example 4 34
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now