Joining multiple result set

人走茶凉 提交于 2019-12-11 12:48:09

问题


I am trying to develop a Java application which merges data from multiple data source basically RDBMS. The scenario is some thing like this.

I have creates a connection to two data sources, lets say a MSSQL database and other Oracle. Also on each connection a user can create a DataObject( a Java object) which contains a SQL query and a connection. The query is executed on the connection and result are displayed.

Now what I want is that my user can join and filter result obtained from multiple DataObject.

Currently I am looking on the following solution:

  • JDO/Hibernate - I will create a object from the ResultSet obtained from the query execution and will use the multiple objects with filter and joining condition.
  • Java RowSet - I will create a RowSet object over result sets and user JoinRowSet and FilteredRowSet to join multiple result set.

    Please advice me on my choice. Also please can other solution be looked into.


    回答1:


    I would suggest the former. To me its as simple as getting the list of entities, and add those in a single list, based on some filter.




    回答2:


    Oracle comes with a generic ODBC gateway that allows you to link the oracle database with another database, so you can join tables from both databases etc. with SQL, as if both tables were on Oracle. See this link for details. By doing that, you don't have to replicate database features in your java program.



    来源:https://stackoverflow.com/questions/2228036/joining-multiple-result-set

  • 易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!