I've following setup
MySQL server instance1 MySQL server instance2
both in these table I've got a single table records that are partitioned. I must retrieve the information from each instance and show the information in JQGrid.
Listed here are the consideration to become made: 1) From each database instance only 1000 records must be got. 2) Merge these 1000 records and sort in climbing order with a default column. 3) Again in the merged records get only 1000 records to become proven inside a Power grid. 4) For the following 1000 records we ought to not show the earlier records that have been proven.
The issue I'm getting is how you can distinctively identify the final row proven in the fetched records.
I figured about doing the work by doing this: 1) Obtain the rowid for every record all the bond. But from two instances the rowid could be same then wouldso would I identify which record comes from which database? 2) Look for rowid and primary key combination. But when the customer sets the main key's auto-increment value as same on all of the instance only then do we wouldn't obtain a unique combination.
Shall We Be Held missing something or perhaps is there every other method of doing it?
I'm using JDBC link with connect the database.
You typically distinctively identify a row having a POJO class in which you override your hashCode() and equals() techniques basing in your class fields. Place the your last row right into a HashMap and appearance against it. A rownumber retrieved in the tables could be accomplished by creating one using RANK() and PARTITION BY. Produce a temporary or tmp_ table together with your merging results then drop it.
hope this can help abit.
when the two mysql instance can easily see one another, what about produce a view, UNION the 2 query results. then in java world, you could do this query/pagination about this view?