permaculture playing cards*
The moose likes Servlets and the fly likes saving messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

saving messages

hon eb
Greenhorn

Joined: Nov 29, 2003
Posts: 3
hi every one i hve tried alot but cant save the incoming messages through java mail API into database ACCESS here is my code plz do do respond. It is not giving any errors at compile time of any kind but still not saving
//FOR DATABASE

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String sourceURL = "jdbc dbc:junk";
Connection databaseConnection=DriverManager.getConnection(sourceURL);
Statement statement=databaseConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);

Subject=message[i].getSubject().toString();
Message=message[i].getContent().toString();
From=message[i].getFrom()[0].toString();
String Date="none";
PreparedStatement stat = databaseConnection.prepareStatement("INSERT INTO MINFO (From,Subject,Message,Date) VALUES(?,?,?,?)");
stat.setString(1,From);
stat.setString(2,Subject);
stat.setString(3,Message);
stat.setString(4,Date);
stat.executeUpdate();
stat.close();
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

hon, please do not cross-post the same question in multiple forums -- it is against JavaRanch policy. Please continue any discussion here.
I am requesting that this topic be closed.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Done.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
jQuery in Action, 2nd edition
 
subject: saving messages
 
Similar Threads
java.sql.Date problem
Syntax error in INSERT statement
saving messages
JDBC-ODBC
java.sql.Date problem