I have two databases (may be different like MySQL and Oracle OR same Oracle as both DB) as DB1 and DB2. I want to compare a table from both the database. In other words,I want to compare DB1.Table1 and DB2.Table1.
I am thinking of two ideas
JDBC Connection : In this I will open two connection (One with MySQL and another with Oracle)and compare all the rows from both of the database.
Hibernate : I can also achieve this by comparing objects from both the databases.
Can anyone explain me what can be the right way to do it, first one, second one or any other way to do it?
Thanks in advance !
This message was edited 1 time. Last update was at by Fidel Edwards
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
There are lots of database diffing tools out there, one of these might save you the effort of writing your own.
If you do want to roll your own, plain old JDBC is probably a better choice. ORMs are not really designed for large scale bulk operations. However, writing something that compares both data and data model is quite a lot of work.
Paul Sturrock wrote:There are lots of database diffing tools out there, one of these might save you the effort of writing your own.
Can't go with any of the tool as it is the requirement for only one table.
Paul Sturrock wrote:
If you do want to roll your own, plain old JDBC is probably a better choice. ORMs are not really designed for large scale bulk operations.
Since table will contain only 250 odd records at maximum, I can anguish with it. In case of JDBC, I'm creating two connections, selecting data from the both the database and preparing the object . But issue here is the right way to compare objects, when I want to compare the records of all the 20 columns of the table.
a) Comparator : will contain 20 getters comparisons
b) toString: will contain prepared list of getters like
And we will be comparing the objects only like
what will be the right approach?
subject: Comparing two tables of different database