开发者

Comparing sql query resultsets in java

I want to run a query programmatically using java on a sql server database running on our dev environment and pr开发者_StackOverflowoduction environment and compare the results. would doing a column by column comparison be the best way to compare the resultsets or is there a better way to do it ?

Thank You


Comparing resultsets would work. The other option would be to create an object for each resultset and compare that. You could define your equals method to handle this, like any other ordinary Java object.

Much of this will depend on what you want to produce in the end. If all you're only concerned about resultset 1 being different from resultset 2, either method would work.


If you can do it in the database, do it in the database in a single query. It will be a lot easier to code, and will run a lot more faster.


Another quick test would be to query the data and dump it to a file then do a diff on the two files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜