Java storing emails

Associate
Joined
7 Dec 2007
Posts
302
Location
Derbyshire, Tibshelf
Hey, making a client/server Java app for uni and I'm wondering what the best way to store private messages would be...

User puts in a recipient, subject, body and time need to be stored...

The data storage method needs to be dynamic sooo... not an array as I originally thought... but perhaps a vector but can these be multidimensional?

Can ArrayList be multidimensional? and if so, needs to be synchronised too (if its possible)

Any advice is great, thanks :)
 
I think linking to an SQL database is a little overkill for such as a simple assignment where we won't receive credit for advanced stuff anyways (as the tutor sucks at Java himself)... I did try storing things in a vector but it gets cleared when the user connects to the server again :S Was gonna try put it in a seperate class... although I'm not really sure why it doesn't work atm or why it would in a class...
 
managed it in the end, made the vector static soo its static on the server..

Got another problem though...
This seems to work once always, then when you try again it randomly either works or it doesn't :S I'm not quite sure if its a problem on client or server side though

On the client:
ObjectOutputStream output = new ObjectOutputStream(connection.getOutputStream());
output.writeObject(sendmail);
output.flush();

On the server:
System.out.println("email adding"); // This always works
ObjectInputStream input = new ObjectInputStream(connection.getInputStream() );
System.out.println("email adding"); //This works only when the ObjectInputStream thing works
 
I'd tackle this with an embedded object databseq. For Java stuff I use db40 give it a google ;)

Super simple i.e db40.storeSomeObject(Object obj) db40.getSomeObject(String name)
 
Back
Top Bottom