jdbc - Comparing Resultsets In java -


i looking ways compare 2 resultsets in java (rs1 , rs2).

things note/requirements

  • the results sets 2 different databases(oracle & sql-server).thus can't make sql query changes copare results fetched.

  • any of resultsets can have more rows each other.

  • any of resultset can have data not in other resultset

example:

rs1                        rs2 column1 column2            column1 column2 column3       1                        2       item1 c       1                  b       4       item2 d       2                  c       2       item3 e       5                  d       1       item4 

expected result

==> valid , because in rs1 & rs2, column2 in rs2 > column2 in rs1

==> b invalid, not there in rs1

==> c valid , because in rs1 & rs2, column2 c in rs2 > column2 c in rs1

==> d invalid , because though there in rs1 , rs2,the column2 d in rs2 < column2 d in rs1

==> e invalid because not there in rs2

looking possible options solve issue.

traverse through both resultsets , store them in map<string, integer>. after can traverse through either of keyset , keep comparing values.

this lets compare 2 resultsets kind of db(oracle, mysql, sqlserver, etc.).


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -