How can I store a MimeMessage object into MySQL and get it back out again?
1 posts in topic
Flat View  Flat View

Posted By:   Edward_Keung
Posted On:   Friday, July 26, 2002 01:05 AM

How do I store a MimeMessage object into MySQL? I tried to use to getInputStream() method and stored the Stream into the database, but how do I get the object back again?

Re: How can I store a MimeMessage object into MySQL and get it back out again?

Posted By:   Eric_Lindauer  
Posted On:   Sunday, August 18, 2002 07:27 PM

Such a complicated question disguised in a simple request! How to get objects out of databases is the basic point of major parts of EJB spec (Entity Beans), and the entire JDO spec deals with this topic. There are proprietary OR-mapping tools (TopLink) to accomplish this, or you could write your own custom solution.

For the simplest possible answer, I suggest you examine the java.sql package. This provides a Java interface which you can use to run SQL against a database. You run a Query, and you get a ResultSet back. You need a JDBC driver to use this, but finding one for MySQL should be easy. If you do some searching for JDBC ( this site has a whole forum devoted to this topic ) you should be able to find some starter examples as well.

Of course, programming in JDBC is quite a pain. You may discover that you long for something a bit more transparent, in which case I'd highly recommend checking out the JDO specification. Regardless, you're on the doorstep of a whole world of complicated issues. Good luck.

Hope this helps.

About | Sitemap | Contact