wood burning stoves 2.0*
The moose likes JDBC and the fly likes RowSet serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "RowSet serialization" Watch "RowSet serialization" New topic
Author

RowSet serialization

Frank Silbermann
Ranch Hand

Joined: Jun 06, 2002
Posts: 1385
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: 1385
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: http://aspose.com/file-tools
 
subject: RowSet serialization
 
Similar Threads
Serializing Vector
diff between java.sql.* and javax.sql.*?
any ideas?
Process results from resultset vs from data structure
query about rowset