Forums Register Login

Storing Object into Database

+Pie Number of slices to send: Send
I have a Person Object with attributes like name, age, sex etc which I wanna store in the sybase database. The column in which it is to be stored is of "text" datatype.

I have converted the object into a Byte Output Stream and stored the object as a Byte Array in to the database. I have done something like this..



Now when I want to read the object from the database I did something like this..




I used rs.getBytes and do the following as shown above. Gives me an sql exception. I used getClob also. Still it gives me some sql exception. What I want is the object back. How do I get it back.


Basically My sybase column datatype is "text". Is there a better way to serialize the object and store in the databse. If there is one please let me know. Note that I cant change the type of column type (text) to any other type...
+Pie Number of slices to send: Send
 

Gives me an sql exception.


And which exception is that?

Are you sure that the Sybase text type supports arbitrary byte sequences?
See where your hand is? Not there. It's next to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 698 times.
Similar Threads
Working with BLOB in Oracle and Java using hibernate
inserting jtable into database
ArrayIndexOutOfBoundsException when saving Serializable
converting InputStream....
Serialization Problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:30:53.