This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes comapre two DB conntaction/schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "comapre two DB conntaction/schema" Watch "comapre two DB conntaction/schema" New topic

comapre two DB conntaction/schema

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1268


I am using sqldeveloper. Want to know how could i compare two different connection/schema. holding same type of tables. I need to comapre values from both schema and try to figureout difference


No Kaustubh No Fun, Know Kaustubh Know Fun..
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3455

Do you need to compare rows in two tables that have the same columns?

I'd use the SQL MINUS operator:
This is just the easiest. A more sophisticated compare might also list rows that have the same primary key but differ in other columns. You'll be much safer if you enumerate the columns instead of using * (see Always use column list).

If the two tables reside on the same database in different schemas, do the compare using an account that was granted the SELECT privilege on both tables. If the two tables reside in different databases, you have several options:

1) Create a database link and run the "minus" queries using the link,
2) Use data pump (expdp/impdp) to bring the two tables into one database, so that you can compare them,
3) Export the data somehow into text/csv files and compare them using different tools (diff, excel or the like).
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1268

Thanks Martin
I agree. Here's the link:
subject: comapre two DB conntaction/schema
Similar Threads
NaN reference
Assertion for Date
Comparing Two EL Expressions
wife and life!
How To compare two excel sheets using java