简体   繁体   English

在哪里使用jdbc Rowsets?

[英]Where jdbc Rowsets are used?

There are some JDBC Rowsets like CachedRowSet , WebRowSet , FilteredRowSet and JoinRowSet . 有一些JDBC 行集,CachedRowSetWebRowSetFilteredRowSetJoinRowSet Does any bode know where they are used? 有没有预知他们在哪里使用? Ok, may be CachedRowSet is good where I do not want open and connection, may be WebRowSet good when I need insert some XML data ("may be" but I do not sure). 好吧,可能是CachedRowSet很好,我不想打开和连接,可能是WebRowSet好我需要插入一些XML数据(“可能是”,但我不确定)。 But what about others? 但其他人呢?

Obviously, It is better for performance to write join in SQL query instead of create 2 JoinRowSet, take all data from they and join fields in java. 显然,在SQL查询中编写连接而不是创建2 JoinRowSet,从中获取所有数据并在java中连接字段更好。 The same about FilteredRowSet - it is more efficient to add where clause to the SQL query instead of grub a lot of the data and filtered it by java. 关于FilteredRowSet也是如此 - 将where子句添加到SQL查询而不是grub大量数据并通过java过滤它更有效。

But somebody "invented" CachedRowSet, WebRowSet, FilteredRowSet and JoinRowSet why? 但有人“发明”了CachedRowSet,WebRowSet,FilteredRowSet和JoinRowSet为什么? Does anybody has some good experience about they usage? 有没有人对他们的使用有一些很好的经验?

The CachedRowSet interface defines the basic capabilities available to all disconnected RowSet objects. CachedRowSet接口定义了所有未连接的RowSet对象可用的基本功能。 The other three are extensions of the CachedRowSet interface, which provide more specialized capabilities. 其他三个是CachedRowSet接口的扩展,它提供了更多的专用功能。 The following information shows how they are related: 以下信息显示了它们的相关性:

A CachedRowSet object has all the capabilities of a JdbcRowSet object plus it can also do the following: CachedRowSet对象具有JdbcRowSet对象的所有功能,并且还可以执行以下操作:

  • Obtain a connection to a data source and execute a query. 获取与数据源的连接并执行查询。
  • Read the data from the resulting ResultSet object and populate itself with 从生成的ResultSet对象中读取数据并使用填充自身
    that data. 那个数据。
  • Manipulate data and make changes to data while it is 处理数据并对数据进行更改
    disconnected. 断开。
  • Reconnect to the data source to write changes back to it. 重新连接到数据源以将更改写回它。
  • Check for conflicts with the data source and resolve those 检查与数据源的冲突并解决这些问题
    conflicts 冲突

A WebRowSet object has all the capabilities of a CachedRowSet object plus it can also do the following: WebRowSet对象具有CachedRowSet对象的所有功能,并且还可以执行以下操作:

  • Write itself as an XML document 将自己写为XML文档
  • Read an XML document that describes a WebRowSet object 阅读描述WebRowSet对象的XML文档

A JoinRowSet object has all the capabilities of a WebRowSet object (and therefore also those of a CachedRowSet object) plus it can also do the following: JoinRowSet对象具有WebRowSet对象的所有功能(因此也具有CachedRowSet对象的功能),还可以执行以下操作:

  • Form the equivalent of a SQL JOIN without having to connect to a data source 形成等效的SQL JOIN,而不必连接到数据源

A FilteredRowSet object likewise has all the capabilities of a WebRowSet object (and therefore also a CachedRowSet object) plus it can also do the following: FilteredRowSet对象同样具有WebRowSet对象的所有功能(因此也是CachedRowSet对象),并且还可以执行以下操作:

  • Apply filtering criteria so that only selected data is visible. 应用过滤条件,以便只显示选定的数据。 This is equivalent to executing a query on a RowSet object without having to use a query language or connect to a data source. 这相当于在RowSet对象上执行查询,而不必使用查询语言或连接到数据源。

RowSet interface, the rows are retrieved from a JDBC data source, but a rowset may be customized so that its data can also be from a spreadsheet, a flat file, or any other data source with a tabular format. RowSet接口,从JDBC数据源检索行,但可以自定义行集,以便其数据也可以来自电子表格,平面文件或具有表格格式的任何其他数据源。

Disconnected (not connected to the data source except when reading data from it or writing data to it) 已断开连接(未连接到数据源,除非从数据源读取数据或向其写入数据)

CachedRowSet

JoinRowSet

FilteredRowSet

WebRowSet

Cached Rowset - being disconnected and able to operate without a driver, is designed to work especially well with a thin client for passing data in a distributed application or for making a result set scrollable and updatable 缓存行集 - 断开连接并且能够在没有驱动程序的情况下运行,旨在与瘦客户端一起工作,以便在分布式应用程序中传递数据或使结果集可滚动和可更新

WebRowSet - the ability to read and write a rowset in XML format. WebRowSet - 以XML格式读取和写入行集的功能。

FilteredRowSet- used to the filtered subset of data from a rowset. FilteredRowSet-用于来自行集的过滤数据子集。

JoinRowSet -used to combine data from two different RowSet objects. JoinRowSet -used用于组合来自两个不同RowSet对象的数据。 This can be especially valuable when related data is stored in different data sources 当相关数据存储在不同的数据源中时,这尤其有用

Documentation 文档

Not sure but this is what I think about FilteredRowSet. 不确定,但这是我对FilteredRowSet的看法。 One can get the data from database by making connection in one shot. 人们可以通过一次连接来获取数据库中的数据。 For example data for city, state and country. 例如,城市,州和国家的数据。 Later one can further subset the data with out going back to database in Java. 稍后,可以进一步对数据进行子集化,而不是使用Java返回数据库。 Such as all records related to city or state or country or combination of them. 例如与城市或州或国家或其组合相关的所有记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM