Because a CachedRowSet object stores data in memory, the amount of data that it can contain at any one time is determined by the amount of memory available. To get around this limitation, a CachedRowSet object can retrieve data from a ResultSet object in chunks of data, called pages. To take advantage of this mechanism, an application sets the number of rows to be included in a page using the method setPageSize. In other words, if the page size is set to five, a chunk of five rows of data will be fetched from the data source at one time. An application can also optionally set the maximum number of rows that may be fetched at one time. If the maximum number of rows is set to zero, or no maximum number of rows is set, there is no limit to the number of rows that may be fetched at a time.After properties have been set, the CachedRowSet object must be populated with data using either the method populate or the method execute. The following lines of code demonstrate using the method populate. Note that this version of the method takes two parameters, a ResultSet handle and the row in the ResultSet object from which to start retrieving rows. CachedRowSet crs = new CachedRowSetImpl(); crs.setMaxRows(20); crs.setPageSize(4); crs.populate(rsHandle, 10); When this code runs, crs will be populated with four rows from rsHandle starting with the tenth row.The next code fragment shows populating a CachedRowSet object using the method execute, which may or may not take a Connection object as a parameter. This code passes execute the Connection object conHandle.Note that there are two differences between the following code fragment and the previous one. First, the method setMaxRows is not called, so there is no limit set for the number of rows that crs may contain. (Remember that crs always has the overriding limit of how much data it can store in memory.) The second difference is that the you cannot pass the method execute the number of the row in the ResultSet object from which to start retrieving rows. This method always starts with the first row. CachedRowSet crs = new CachedRowSetImpl(); crs.setPageSize(5); crs.execute(conHandle); After this code has run, crs will contain five rows of data from the ResultSet object produced by the command for crs. The writer for crs will use conHandle to connect to the data source and execute the command for crs. An application is then able to operate on the data in crs in the same way that it would operate on data in any other CachedRowSet object. .....
Java
Topic: JDBC
Explain Paging Data?
Browse random answers:
What does the connection object represents?
Explain method Creating a CachedRowSet Object?
Explain Retrieving Data from a CachedRowSet Object?
Explain method Retrieving RowSetMetaData?
Explain method Updating a CachedRowSet Object?
Explain method Updating the Underlying Data Source?
Explain method Registering and Notifying Listeners?
Explain method Passing Data to Thin Clients?
Explain Scrolling and Updating?
Explain Getting Universal Data Access?
Explain Setting Properties?
Explain Paging Data?
Explain Background?
Explain Predicate Sharing?
Explain Updating a FilteredRowSet Object?
Explain Behavior of Rows Outside the Filter?
Explain Creating a JdbcRowSet Object?
Explain boolean getShowDeleted() throws SQLException?
Explain void setShowDeleted(boolean b) throws SQLException?
Explain about getRowSetWarningsRowSetWarning getRowSetWarnings() throws SQLException?
Explain about void commit() throws SQLException?
Explain getAutoCommitboolean getAutoCommit() throws SQLException?
Explain void setAutoCommit(boolean autoCommit) throws SQLException?
Explain about void rollback() throws SQLException?
Explain void rollback(Savepoint s) throws SQLException?
Explain about Managing Multiple Match Columns?
Explain about void setMatchColumn(int columnIdx) throws SQLException?
Explain setMatchColumnvoid setMatchColumn(int[] columnIdxes) throws SQLException
Explain about setMatchColumnvoid setMatchColumn(String columnName) throws SQLException?
Explain about setMatchColumnvoid setMatchColumn(String[] columnNames) throws SQLException?
Explain about getMatchColumnIndexesint[] getMatchColumnIndexes() throws SQLException
Explain about getMatchColumnNamesString[] getMatchColumnNames() throws SQLException?
Explain about unsetMatchColumnvoid unsetMatchColumn(int columnIdx) throws SQLException
Explain about unsetMatchColumnvoid unsetMatchColumn(int[] columnIdxes) throws SQLException?
Explain unsetMatchColumnvoid unsetMatchColumn(String columnName) throws SQLException?
UnsetMatchColumnvoid unsetMatchColumn(String[] columnName) throws SQLException
Using a JoinRowSet Object for Creating a JOIN
JoinRowSet Methods
Explain method CROSS_JOIN?
Explain about INNER_JOINstatic final int INNER_JOIN?
Explain the difference between LEFT_OUTER_JOINstatic final int LEFT_OUTER_JOIN?
Explain method RIGHT_OUTER_JOIN?
Explain the difference between FULL_JOINstatic final int FULL_JOIN
Explain about addRowSetvoid addRowSet(Joinable rowset) throws SQLException?
Explain about addRowSetvoid addRowSet(RowSet rowset, int columnIdx) throws SQLException?
Explain about addRowSetvoid addRowSet(RowSet rowset, String columnName) throws SQLException?
Explain about addRowSetvoid addRowSet(RowSet[] rowset, int[] columnIdx) throws SQLException?
Explain about addRowSetvoid addRowSet(RowSet[] rowset, String[] columnName) throws SQLException?
Explain about getRowSetsCollection<?> getRowSets() throws SQLException?
Explain getRowSetNamesString[] getRowSetNames() throws SQLException?
Explain toCachedRowSetCachedRowSet toCachedRowSet() throws SQLException?
Explain aboutpublic abstract class BaseRowSetextends Objectimplements Serializable, Cloneable?
Explain the difference between UNICODE_STREAM_PARAMpublic static final int UNICODE_STREAM_PARAM?
Explain the difference between BINARY_STREAM_PARAMpublic static final int BINARY_STREAM_PARAM?
Explain the difference between ASCII_STREAM_PARAMpublic static final int ASCII_STREAM_PARAM?
Explain the difference between binaryStreamprotected InputStream binaryStream?
Explain the difference between unicodeStreamprotected InputStream unicodeStream?
Explain the difference between asciiStreamprotected InputStream asciiStream?
Explain the difference between charStreamprotected Reader charStream?
Explain the difference between BaseRowSetpublic BaseRowSet()?
Explain the difference between initParamsprotected void initParams()?
Explain about addRowSetListenerpublic void addRowSetListener(RowSetListener listener)?
Explain about removeRowSetListenerpublic void removeRowSetListener(RowSetListener listener)?
Explain notifyCursorMovedprotected void notifyCursorMoved() throws SQLException?
Explain notifyRowChangedprotected void notifyRowChanged() throws SQLException?
Explain notifyRowSetChangedprotected void notifyRowSetChanged() throws SQLException?
Explain getCommandpublic String getCommand()
Explain about public void setCommand(String cmd) throws SQLException
Explain about public String getUrl() throws SQLException?
Explain about setUrlpublic void setUrl(String url) throws SQLException?
Explain getDataSourceNamepublic String getDataSourceName()?
Explain setDataSourceNamepublic void setDataSourceName(String name) throws SQLException ?
Explain getUsernamepublic String getUsername( ) ?
Explain setUsernamepublic void setUsername(String name)?
Explain getPasswordpublic String getPassword()?
Explain method setPasswordpublic void setPassword(String pass)?
Explain method setTypepublic void setType(int type) throws SQLException ?
Explain method getTypepublic int getType() throws SQLException ?
Explain method setConcurrencypublic void setConcurrency(int concurrency) throws SQLException ?
Explain method isReadOnlypublic boolean isReadOnly()?
Explain method setReadOnlypublic void setReadOnly(boolean value) ?
Explain method getTransactionIsolationpublic int getTransactionIsolation() ?
Explain method setTransactionIsolationPublic void setTransactionIsolation(int level) throws SQLException
Explain method getTypeMappublic Map<String,Class<?>> getTypeMap()?
Explain method setTypeMappublic void setTypeMap(Map<String,Class<?>> map)?
Explain method getMaxFieldSizepublic int getMaxFieldSize() throws SQLException?
Explain method setMaxFieldSizepublic void setMaxFieldSize(int max) throws SQLException ?
Explain method getMaxRowspublic int getMaxRows() throws SQLException?
Explain method setMaxRowspublic void setMaxRows(int max) throws SQLException?
Explain method setEscapeProcessingpublic void setEscapeProcessing(boolean enable) throws SQLException ?
Explain method getQueryTimeoutpublic int getQueryTimeout() throws SQLException ?
Explain setQueryTimeoutpublic void setQueryTimeout(int seconds) throws SQLException ?
Explain method getShowDeletedpublic boolean getShowDeleted() throws SQLException ?
Explain public void setShowDeleted(boolean value) throws SQLException ?
Explain method getEscapeProcessingpublic boolean getEscapeProcessing() throws SQLException ?
Explain method setFetchDirectionpublic void setFetchDirection(int direction) throws SQLException ?
Explain method getFetchDirectionpublic int getFetchDirection() throws SQLException ?
Explain method setFetchSizepublic void setFetchSize(int rows) throws SQLException ?
Explain method getFetchSizepublic int getFetchSize() throws SQLException ?
Explain method getConcurrencypublic int getConcurrency() throws SQLException ?