Carlo Indolfi wrote:
> "Craig R. McClanahan" wrote:
>
> > Umm, I *do* believe that a NotSerializableException means that the
> > OracleResultSet is, err, not serializable :-).
>
> :-)
>
> > You are going to need to use some other sort of data structure to accomplish
> > your goal of passing a container object back and forth -- one that you
> > explicitly declare to be Serializable (and all the instance variables inside
> > it must be as well). The OracleResultSet object can't be serialized because
> > the author did not declare it Serializable (for some very logical reasons that
> > become clear when you look at how JDBC drivers are typically implemented).
>
> How can I implement it??? Because of it is not a class that I explicitly use, but
> I suppose that is a class that the Jdbc use in his runtime execution, how can I
> resolve this problem???
>
> Thank's in advance
> Regards
> Carlo
>
The JDBC driver is not going to help you at all in this regard. You are going to
have to copy the information you want to transport back and forth into your own data
structure.
Just as one example of what you might do, consider using a Vector (which implements
Serializable) as your outer container. Each entry in the Vector would represent one
row of the result set, and each row would be represented by a Hashtable whose keys
are the column names and whose values are whatever object represent's the column
value in that row.
To use this, you'd do something like the following:
* Execute the query and get the ResultSet.
* Copy the data contents of the result set into
your new data structure (in the example above,
you'd create a Hashtable for each row's columns
and then add the Hashtable to the Vector)
* Forward the data structure to your other servlet
(or whatever) for its use.
* The other code would read the information from
your data structure (not as a ResultSet), make
whatever changes it needed to, and send the
container back again.
The key point is that you are on your own -- the JDBC structures provided by your
driver are not going to be Serializable, so you can't use an object stream to send
them anywhere.
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html