public void sendMail(String smtpServer,Stri ng to,String from,String subject,String body ) throws Exception{
try{
SendMail.send(s mtpServer,to,fr om,subject,body );
log.info("Mail delivered to: " +to);
System.out.prin t("Mail Delivered !!!"+to);
try{
Connection con = null;
PreparedStateme nt stmt = null;
ResultSet rs = null;
List result=null;
Map resultMap = null;
con = Utilities.getDb Connection();
result = new ArrayList();
stmt = con.prepareStat ement("INSERT INTO call_history " +
"(pis_cd,email, remarks) " +
" values(?,?,?)") ;
stmt.setString( 1,pisCd);
stmt.setString( 2,email);
stmt.setString( 3,remarks);
stmt.executeUpd ate();
con.commit();
log.info("Added a new message: " + pisCd +" by "+ pisCd);
//System.out.prin tln("Added a new bank: " + bankDesc +" by "+ us.getName());
}
//error starts from here
catch (SQLException errSql){
con.rollback();
log.error("err: "+ errSql);
throw errSql;
}}
catch (Exception err){
if (con != null) con.rollback();
log.error("err: "+ err);
throw err;
}finally {
try {
if (rs != null) rs.close();
if (stmt != null) stmt.close();
if (con != null) con.close();
} catch (Exception err){
log.debug("cant send mail due to: "+err );
throw new Exception(" Please check smtp, admin email address. "+err);
}
}
}
error in stmt,con,rs
plz help me
try{
SendMail.send(s mtpServer,to,fr om,subject,body );
log.info("Mail delivered to: " +to);
System.out.prin t("Mail Delivered !!!"+to);
try{
Connection con = null;
PreparedStateme nt stmt = null;
ResultSet rs = null;
List result=null;
Map resultMap = null;
con = Utilities.getDb Connection();
result = new ArrayList();
stmt = con.prepareStat ement("INSERT INTO call_history " +
"(pis_cd,email, remarks) " +
" values(?,?,?)") ;
stmt.setString( 1,pisCd);
stmt.setString( 2,email);
stmt.setString( 3,remarks);
stmt.executeUpd ate();
con.commit();
log.info("Added a new message: " + pisCd +" by "+ pisCd);
//System.out.prin tln("Added a new bank: " + bankDesc +" by "+ us.getName());
}
//error starts from here
catch (SQLException errSql){
con.rollback();
log.error("err: "+ errSql);
throw errSql;
}}
catch (Exception err){
if (con != null) con.rollback();
log.error("err: "+ err);
throw err;
}finally {
try {
if (rs != null) rs.close();
if (stmt != null) stmt.close();
if (con != null) con.close();
} catch (Exception err){
log.debug("cant send mail due to: "+err );
throw new Exception(" Please check smtp, admin email address. "+err);
}
}
}
error in stmt,con,rs
plz help me
Comment