Results 1 to 7 of 7
  1. #1
    prachib is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Post Compare two resultsets and find the difference in java

    I have 2 databases one is oracle and other one is Sql Server.
    I successfully connected to both the databases.

    I want to compare the table data residing in these databases.

    I querried table A from oracle lets say in resultset rs1 and
    querried table B from SAP HANA,say rs2.

    Now i want to compare these resultsets,whether they are equal or not,if not then which rows are different.

    I tried with arraylist comparision,csv file comparison also,but as the no of rows is quite large(12,00,000) for some tables,its geting stucked.
    Pls suggest an alternative approach or is any utility is available for this??

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Compare two resultsets and find the difference in java

    Moved from a staff-only section.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: Compare two resultsets and find the difference in java

    How can you tell the difference?
    Do you mean to check every column, or is it OK to simply see which id's exist in one, but not the other?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    prachib is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default Re: Compare two resultsets and find the difference in java

    hello friend,
    I just want to check whether every row of one resultset is matching with the row of other resultset.(There is no such PK defined)
    If exists ok....if not then which row it is??Then will write this row in csv file.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: Compare two resultsets and find the difference in java

    So then you want to check every column.
    That's unlikely to be quick, especially since you have no PK.
    Is it both ways?
    If a row is in SQL Server but not Oracle does that count, and vice versa?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    prachib is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default Re: Compare two resultsets and find the difference in java

    I m concerned with the 1st resultset.....whichever rows are not presented in 2nd resultset that i want to know......

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: Compare two resultsets and find the difference in java

    With no key then all you can do is crunch them.
    How many columns in the table?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 2
    Last Post: 07-13-2012, 10:15 AM
  2. Difference between java v1.5 and v1.6
    By zaniwhoop in forum New To Java
    Replies: 1
    Last Post: 03-20-2012, 09:38 AM
  3. need help with ResultSets !!!
    By ady_bavarezu89 in forum JDBC
    Replies: 7
    Last Post: 01-21-2011, 12:15 PM
  4. Replies: 3
    Last Post: 02-02-2010, 01:33 PM
  5. Compare two arrays for difference
    By aaronfsimons in forum New To Java
    Replies: 2
    Last Post: 05-11-2009, 03:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •