dcsimg
how can i do a message with database?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   weixiazero_weixiazero
Posted On:   Monday, April 29, 2002 06:46 AM

i use javaMail to download the message from the server and i want to save it to the database,
know that message doesn't implement serialization,I have to use it's inputStream to save to the database like these:
pStmt.setBinaryStream(4,
msgs.getInputStream(),msgs.getSize()); [4 field is blob data]
pStmt.execute();
but when i want to get it out from the database as the form of Message,how can i do?
i have attampted to use this sentence:
Message msg=(Message)resultset.getObject(4); and there is an classcastException thrown
anybody who can help me with this proplem?? I just want to change it to the message form

Re: how can i do a message with database?

Posted By:   Anonymous  
Posted On:   Monday, April 29, 2002 05:07 PM

Using this method, the message is not saved, only its content is, so that why you can't cast to a Message object. You will have to create a new message, and then and the content from the db into the message.
About | Sitemap | Contact