Sunday, September 03, 2006

Manipulating Tabular Data using JDBC RowSet API

If you Google "Tabular Data", you will get more than 2 millions hits, which is an illustration of the pervasive and broad scope of the concept. So what are tabular data? The following proposal might not be the most well thought definition but tabular data can be defined as data organized or presented as items/columns and records/rows that can be stored in (or retrieved from) various persistence repositores including file system, spreadsheet, relational tables, XML documents and so on.

This blog will introduce the goals the JSR-114 RowSet, briefly describe the various models and furnish pointers to get further details and code samples.

Why JDBC RowSet?

When dealing with tabular data, a number of Java SE/EE and Web Services requirements (such as JavaBean properties, XML documents properties) that are not addressed by the existing JDBC interfaces.

The RowSet specification (http://www.jcp.org/en/jsr/detail?id=114) addresses the following requirements and shortcomings of JDBC specifications:

  • Make query results scrollable and updatable without relying on the underlying JDBC driver
  • Manipulate data (e.g., filtering and joining) and make changes while disconnected from data sources
  • Associate properties and event listeners to query results to facilitate manipulation by tools
  • Consume data results in chunks and ship result set to thin clients, handheld devices, and PDAs which are most of the time not connected and do not have a full-fledged JDBC driver
  • Convert data results to or from XML documents.

The RowSets Models

The RowSet Specification (JSR-114) formalizes and completes the concept of RowSet introduced in JDBC 2.0. It defines five standard JDBC RowSet interfaces including: JdbcRowSet, CachedRowSet, WebRowSet, JoinRowSet, and FilteredRowSet (see Figure 1 below).

The RowSet Hierarchy

The base JDBC RowSet interface (javax.sql.Rowset) encapsulate/extend ResultSets (java.sql.ResultSet) through a set of properties including: datasource, datasourcename, url, username, password, typeMap, maxFiedSize, maxRows, queryTimeout, fetchsize, transactionisolation, escapeProcessing, command, concurrency, readOnly, fetchDirection, as well as events and an event listener mechanism.
In general, each rowset model is populated from a repository using the repositorey-specific APi (i.e., JDBC for RDBMS), then manipulated using the towset-model-specific methods.
In the rest of this blog, I'll give you a brief description of each model excerpted from my book (a full coverage of the RowSet API is beyond the scope of a blog).

JDBCRowSet

The JDBCRowSet object is a JavaBean equivalent of ResultSet; as such, it maintains a connection to its datasource, has a set of properties,and a listener notification mechanism. The contents are identical to those of a ResultSet object, and it inherits all of the result set methods for rows manipulation, cursor movement, and data manipulation.
The OracleJDBCRowSet class implements the javax.sql.rowset.JdbcRowSet interface.

CahedRowSet

The CachedRowSet object represents disconnected RowSet such that the row data and metadata can persist beyond the connection. When the connection to the database is restored, any modifications to the RowSet are propagated back to the database. It caches its rows in memory and allows operating on these without being connected to the datasource, resulting in increased scalability. In addition, it turns any result set object (even the read-only ones) into scrollable and updatable rowsets.
The OracleCachedRowSet class implements the javax.sql.rowset.CachedRowSet interface.

WebRowSet

A WebRowSet object is a CachedRowSet object, augmented with a default WebRowSetXmlReader, which reads an XML document into the rowset, and a default WebRowSetXmlWriter, which writes the rowset as an XML document.

You can:
  • Create a WebRowSet object and dump its contents to an XML document.
  • Read an XML document into a WebRowSet object.
  • Make changes to a WebRowSet object (Insert, Update, Delete rows) and synchronize it back to the datasource.

The W3C XML schema for WebRowSet is defined by Sun, and available at http://java.sun.com/xml/ns/jdbc/webrowset.xsd.

The oracle.jdbc.rowset.OracleWebRowSet class implements the javax.sql.rowset.WebRowSet interface. The oracle.jdbc.rowset.OracleWebRowSetXmlWriter class extends the javax.sql.rowset.spi.XmlWriter.

FilteredRowSet

A FilteredRowSet object simulates a SQL WHERE clause by applying user-defined filtering criteria on rows in a disconnected rowset; in other words, it returns/retrieves only rows that meet the defined criteria, and inserts/updates only rows that meet the constraints defined in the filter(s). The constraints are defined within a predicate class then assign this predicate to the FilteredRowSet object; as a result, the constraints defined in the predicate class will be evaluated against each row in the rowset object.In order to use filtered rowsets the JDBC applications must:

  • Define and implement the Predicate interface.
  • Create an instance of FilteredRowSet object and set properties.
  • Populate the FilteredRowSet.
  • Set/enable filters.
  • Retrieve the filtered rows.

The oracle.jdbc.rowset.OracleFileteredRowSet class implements the javax.sql.rowset.FilteredRowSet; in addition the oracle.jdbc.rowset.OraclePredicate interface inherits from the javax.sql.rowset.Predicate.


JoinRowSet

The JoinRowSet object represents a SQL JOIN operation between disconnected RowSet objects.A JoinRowSet object combines data from multiple rowsets. In order to use Join rowsets, the JDBC applications must:
  • Create an empty instance of JoinRowSet object and set properties.
  • Create and add RowSets objects to the JoinRowSet.
  • Define the match column (similar to SQL matching columns).
  • Navigate and consume the JoinRowSet Object.

The oracle.jdbc.rowset.OracleJonRowSet class implements the javax.sql.rowset.JoinRowSet interface.


Further Details

The JSR-114 furnishes a reference implementation of each rowset type as part of Java/JDK 5.0, or as stand-alone Jars (i.e., rowsetjsr114.jar) that can be used on top of any standard JDBC driver. Oracle implements JSR-114 specification as part of the JDBC drivers (i.e., ojdbc14.jar).

For more details, see:

8 comments:

Anonymous said...

Hi,
I Found Absolutely FREE PlayBoy & PentHouse:
http://www.girlsupdates.com
http://www.oxpe.net
If I find something else I'll inform you.
Best Regards, Jenya

Anonymous said...

情趣用品,情趣用品,情趣用品,情趣用品,情趣,情趣,情趣,情趣,按摩棒,震動按摩棒,微調按摩棒,情趣按摩棒,逼真按摩棒,G點,跳蛋,跳蛋,跳蛋,性感內衣,飛機杯,充氣娃娃,情趣娃娃,角色扮演,性感睡衣,SM,潤滑液,威而柔,香水,精油,芳香精油,自慰套,自慰,性感吊帶襪,吊帶襪,情趣用品加盟AIO交友愛情館,情人歡愉用品,美女視訊,情色交友,視訊交友,辣妹視訊,美女交友,嘟嘟成人網,成人網站,A片,A片下載,免費A片,免費A片下載愛情公寓,情色,舊情人,情色貼圖,情色文學,情色交友,色情聊天室,色情小說,一葉情貼圖片區,情色小說,色情,色情遊戲,情色視訊,情色電影,aio交友愛情館,色情a片,一夜情,辣妹視訊,視訊聊天室,免費視訊聊天,免費視訊,視訊,視訊美女,美女視訊,視訊交友,視訊聊天,免費視訊聊天室,情人視訊網,影音視訊聊天室,視訊交友90739,成人影片,成人交友,美女交友,微風成人,嘟嘟成人網,成人貼圖,成人電影,A片,豆豆聊天室,聊天室,UT聊天室,尋夢園聊天室,男同志聊天室,UT男同志聊天室,聊天室尋夢園,080聊天室,080苗栗人聊天室,6K聊天室,女同志聊天室,小高聊天室,上班族聊天室,080中部人聊天室,同志聊天室,聊天室交友,中部人聊天室,成人聊天室,一夜情聊天室,情色聊天室,寄情築園小遊戲情境坊歡愉用品,情趣用品,成人網站,情人節禮物,情人節,AIO交友愛情館,情色,情色貼圖,情色文學,情色交友,色情聊天室,色情小說,七夕情人節,色情,情色電影,色情網站,辣妹視訊,視訊聊天室,情色視訊,免費視訊聊天,美女視訊,視訊美女,美女交友,美女,情色交友,成人交友,自拍,本土自拍,情人視訊網,視訊交友90739,生日禮物,情色論壇,正妹牆,免費A片下載,AV女優,成人影片,色情A片,成人論壇,情趣,免費成人影片,成人電影,成人影城,愛情公寓,成人影片,保險套,舊情人,微風成人,成人,成人遊戲,成人光碟,色情遊戲,跳蛋,按摩棒,一夜情,男同志聊天室,肛交,口交,性交,援交,免費視訊交友,視訊交友,一葉情貼圖片區,性愛,視訊,視訊聊天,A片,A片下載,免費A片,嘟嘟成人網,寄情築園小遊戲,女同志聊天室,免費視訊聊天室,一夜情聊天室,聊天室

new laptop battery said...

We specialize in laptop battery,laptop AC adapters. All our products are brand new, with the excellent service from our laptop battery of customer service team.
the most convenient and cheap replacement battery online shop in uk. We specialize in laptop batteries, laptop AC adapters.
All our laptop AC adapters are brand new, with the excellent service from our customer service team.
the most convenient and cheap battery online shop in uk.
You can find some battery and adapter from here is very cool.

said...

A片,A片,成人網站,成人漫畫,色情,情色網,情色,AV,AV女優,成人影城,成人,色情A片,日本AV,免費成人影片,成人影片,SEX,免費A片,A片下載,免費A片下載,做愛,情色A片,色情影片,H漫,A漫,18成人

a片,色情影片,情色電影,a片,色情,情色網,情色,av,av女優,成人影城,成人,色情a片,日本av,免費成人影片,成人影片,情色a片,sex,免費a片,a片下載,免費a片下載

情趣用品,情趣用品,情趣,情趣,情趣用品,情趣用品,情趣,情趣,情趣用品,情趣用品,情趣,情趣

A片,A片,A片下載,做愛,成人電影,.18成人,日本A片,情色小說,情色電影,成人影城,自拍,情色論壇,成人論壇,情色貼圖,情色,免費A片,成人,成人網站,成人圖片,AV女優,成人光碟,色情,色情影片,免費A片下載,SEX,AV,色情網站,本土自拍,性愛,成人影片,情色文學,成人文章,成人圖片區,成人貼圖

情色,AV女優,UT聊天室,聊天室,A片,視訊聊天室

Anonymous said...

童裝批發
童裝批發
童裝
童裝
酒店喝酒
酒店消費
暑假打工
寒假打工
酒店經紀人
酒店現領
禮服店
酒店小姐
酒店兼職
酒店上班
酒店兼職
禮服店
酒店上班
酒店打工
酒店小姐
酒店經紀
酒店兼差
假日打工
台北酒店經紀
寒暑假打工
專業酒店經紀
酒店藝名
台北酒店
酒店日保
酒店入行
台北禮服店
酒店類型
酒店午場
酒店規定
酒店行政
酒店資訊

las vegas wedding chapels said...

The reality is that very few JDBC drivers or Java frameworks furnish true/reliable connection or transaction failover mechanisms.

wasirdenature said...

obat gonore atau kemaluan keluar cairan nanah obat cairan nanah keluar dari alat kelamin obat alat kelamin keluar nanah obat kemaluan keluar nanah obat wasir herbal obat kutil kelamin ampuh cara mengobati sipilis penyakit kencing nanah cara mengobati ujung kemaluan keluar nanah cara mengobati ujung kemaluan keluar nanah cara mengobati ujung kemaluan keluar nanah cara mengobati ujung kemaluan keluar nanah kemaluan yang keluar nanah kemaluan keluar nanah tapi tidak sakit obat wasir luar stadium obat herbal wasir stadium kenapa kemaluan lelaki keluar nanah obat ambeien tradisional paling ampuh obat ambeien tanpa operasi obat wasir ampuh di apotik obat wasir ibu hamil obat ampuh wasir berdarah obat untuk kemaluan lelaki yang keluar nanah obat penyakit gonore atau kemaluan keluar nanah

lionelmessi10 said...

obat gonore atau kemaluan keluar cairan nanah obat cairan nanah keluar dari alat kelamin obat alat kelamin keluar nanah obat kemaluan keluar nanah obat wasir herbal obat kutil kelamin ampuh cara mengobati sipilis penyakit kencing nanah cara mengobati ujung kemaluan keluar nanah cara mengobati ujung kemaluan keluar nanah cara mengobati ujung kemaluan keluar nanah cara mengobati ujung kemaluan keluar nanah kemaluan yang keluar nanah kemaluan keluar nanah tapi tidak sakit obat wasir luar stadium obat herbal wasir stadium kenapa kemaluan lelaki keluar nanah obat ambeien tradisional paling ampuh obat ambeien tanpa operasi obat wasir ampuh di apotik obat wasir ibu hamil obat ampuh wasir berdarah obat untuk kemaluan lelaki yang keluar nanah obat penyakit gonore atau kemaluan keluar nanah