File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes RowSet serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "RowSet serialization" Watch "RowSet serialization" New topic

RowSet serialization

Frank Silbermann
Ranch Hand

Joined: Jun 06, 2002
Posts: 1405
A disconnected RowSet can be serialized, sent to a client for update, and de-serialized back at the server to synchronize the changes with the database.

I suppose that the RowSet cannot be serialized until it has been disconnected; i.e. the Connection closed. But what happens to the DataSource attribute during serialization? You can have a DataSource object without being connected to the database. (It merely retains the information needed to _get_ an active database Connection).

I suppose it would be convenient for a serialized RowSet to maintain the DataSource information. Then, when the updated RowSet is returned by the remote client, it remembers how to reconnect to the database.

But I see some dangers with allowing the DataSource to be serialized. The client might try to reconnect the RowSet to the database without having the necessary database drivers (or permissions). Of course, the RowSet could simply throw an exception, but this would be kind of ugly.

My guess is that the DataSource is a nonserialized attribute of the RowSet -- and therefore which would have to be reset upon deserialization before updates could be synchronized. Is this indeed the specification?

(I suppose I could write a program to try it out myself, but that would say more about my specific RowSet implementation than about the way it _should_ work.)
Frank Silbermann
Ranch Hand

Joined: Jun 06, 2002
Posts: 1405
Can anyone point me to the JavaDoc API for Sun's reference implementation "CachedRowSetImpl"? That might answer my question.
I agree. Here's the link:
subject: RowSet serialization
It's not a secret anymore!