Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL ResultSet NotSerializableException

Posted on 1997-05-08
5
Medium Priority
?
367 Views
Last Modified: 2008-02-26
I got this exception while trying to pass a ResultSet object by rmi. My version of JDK is 1.0.2 and I have the last rmi version for JDK 1.0.2.

This is the execption -->

rmiClient exception: Error unmarshaling return; nested exception is:
        java.io.WriteAbortedException: Writing aborted by exception; java.io.Not
SerializableException: sun.jdbc.odbc.JdbcOdbcResultSet
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
        java.io.WriteAbortedException: Writing aborted by exception; java.io.Not
SerializableException: sun.jdbc.odbc.JdbcOdbcResultSet
        at domtar.server.rmiServer_Stub.getResultSet(rmiServer_Stub.java:65)
        at domtar.client.rmiClient.getResultSet(rmiClient.java:57)
        at Client.executeQuery(Client.java:258)
        at Client.start(Client.java:247)
        at sun.applet.AppletPanel.run(AppletPanel.java:271)
        at java.lang.Thread.run(Thread.java:294)
java.lang.NullPointerException
        at Client.fillGridSecteur(Client.java:309)
        at Client.executeQuery(Client.java:260)
        at Client.start(Client.java:247)
        at sun.applet.AppletPanel.run(AppletPanel.java:271)
        at java.lang.Thread.run(Thread.java:294)
0
Comment
Question by:pjroy
5 Comments
 
LVL 1

Expert Comment

by:mlimotte
ID: 1220257
I believe that the ResultSet object keeps an open cursor to the database.  It does not load in the complete contents of the query, and therefore, can not be serialized (all the data is not available).  

As a work around, try loading all the data into a common data structure (an array or vector).
0
 
LVL 1

Expert Comment

by:mlimotte
ID: 1220258
I believe that the ResultSet object keeps an open cursor to the database.  It does not load in the complete contents of the query, and therefore, can not be serialized (all the data is not available).  

As a work around, try loading all the data into a common data structure (an array or vector).
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1220259
For what its worth, marshaling is the proces by which the client and server guarantee that data is being transfered in a safe and compatible manner.

An unmarhaling exeption is usualy cast when when you have IDL level incompatibilities between the client and the server. (integer size for exaple).

In DB oriented apps, it can also be cast when you bind local variables to SQL columns that do not match. (Java 2-byte chars to SQL 1 byte chars for instance.)

Now if the error is actualy related to the serialization process (and is not appearing as a side effect of an IDL definition error). Than Java is trying to serialize a value of one data type but actualy obtaining a value of another.

Hope this helps to gain an insight into the problem.
0
 

Accepted Solution

by:
rkin005 earned 0 total points
ID: 1220260
Well, the class ResultSet doesn't implement the interface
Serializable.  Therefore you can't pass it thru RMI.

0
 

Expert Comment

by:exprd
ID: 2205006
Since the Resultset is not serialiazable, it looses it's state while been transfered from server to client. So, put the values from resultset to a vector since u don't know the size of the resultset , vector is recomended, and send.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question