title: Comparing two tables from separate databases in DB2
body: <p>I have a requirement where I want to reconcile data between tables which are in different databases in DB2 and out put the differences as a report in java. </p>
  
  <p>The approach I am thinking of is:</p>
  
  <ul>
  <li>Read first table in a Java Map Collection</li>
  <li>Read second table in a Java Map Collection</li>
  <li>Compare the two maps</li>
  <li>Output the difference in a report</li>
  </ul>
  
  <p>Is there any other efficient way to do this through java and sql ?</p>
  
  <p>The tables will have around 10 to 15 columns and around 20000 rows of data. </p>
  
  <p>Is my approach correct ?</p>
  
  <p>P.S.: Things like federating one table into the other database etc. are not allowed.</p>