Solved

merging 2 mysql databases with java

Posted on 2016-07-15
7
74 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
spring maven example issues 3 101
dao vs facade design patterns 2 69
Java pass by reference 3 74
Undefined variable with $_POST in PHP 5 38
In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:

734 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