Populating RowSet with another RowSet

Hi, I am working on a client/server querying application. I want to keep the entire result of query on the server and send blocks of this result to the client on demand. Let's consider a RowSet (serverRS) of 100 elements and I want to send rows 21 to 40 to the client. How can I populate a RowSet (clientRS) with those rows? Eliminating the first rows seems easy by calling serverRS.absolute(21) before calling clientRS.populate(serverRS) but I cannot find an easy way for the rows after row 40? Can u help me?

Are you querying a database on the server? Or are you querying your own server implementation of some sort. Basically, I am not sure this question is about and belongs in the JDBC forum. If you could clarify what you are doing I may be able to find a better forum for this question or I will leave it here.

I am querying a database on the server and cache the obtained ResultSet. I would like to send this data to my client by blocks (on demand) as RowSet. My problem is to extract the block from the cached ResultSet and put it in the serializable RowSet that i send to the client. Don't hesitate to ask for some clarifications if i am not making myself clear.

I think what you need to do is scrap the ResultSet all together and use the RowSet API in the JDBC spec. I am still not entirely clear on what you are trying to do. But to me it looks like you have an extra step. Query the Database Put data in RowSet Send chucks of that RowSet to a client So if this is accurate, I would ask why not allow the client to query the database and return what it needs? BTW - Here is a tutorial on using the JDBC RowSet API (CachedRowSet, JDBCRowSet, WebRowSet). If I am way off track let me know.

I think this is the scenario that we are describing: 1) We extract data from a database and store the result in a CachedRowSet. 2) We want to send part of this RowSet to a client as a new RowSet object. There may be several reasons that the client can not access the database directly. It could be a firewall issue or simply a size issue. The question is, can I create a new RowSet from the middle of an existing RowSet. I don't see any straight forward way to do this from the documentation. In fact, although using absolute(21) works, since this is not documented I would be nervous about relying on it. It just happens that the implementation does not reset the ResultSet to the beginning but I see nothing that would make me think that this is guaranteed in all implementations. You could create a new RowSet using populate() and then delete the unwanted rows. Or you could create a new empty RowSet, copy the MetaData over, and then insert rows. Neither is a very pretty solution. Perhaps the easiest way would be to write your own implementation, extending CachedRowSetImpl.