Posts

Showing posts from August, 2013

Set current date as default for date Type in mysql

I have  to add new columns in table 'order' namely shippedDate and last_updated  which consist of datetime data type. i would like to do the following. a) Set shippedDate defaults value to MySQL NOW() or CURRENT_DATE    b) Set last_updated default value to  CURRENT_TIMESTAMP   Instead of null which it uses by default. as the table already exist and it already some existing records i would like to do Modify table, i tried using two different code but none is working. ALTER TABLE orders  ADD COLUMN  shippedDate   Date NULL default  CURRENT_DATE   AFTER 'previoueColumn' , ADD COLUMN ` last_updated  ` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP  AFTER ` shippedDate  ` ; It gives me Error :Error 1067 : Invalid default value for  shippedDate. is it possible for me to set the default datetime value to NOW() in MySQL? thank you...

javax.mail.AuthenticationFailedException: 535 No SMTP server defined. Use real server address instead of 127.0.0.1 in your account.

I am trying to send mail using below program :-  public class mail { public static void main(String[] args) { final String username = "****@gmail.com"; final String password = "****"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props,  new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); }  }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("piyush.mundada89@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("piyush.mundada89@gmail.com&

Parsing error processing resource path /WEB-INF/struts-config.xml

I am using struts  to develop an apps. I get the following error while trying to load the application. issue 1 :  org.xml.sax.SAXParseException; systemId: jndi:/project/WEB-INF/struts-config.xml;  The end-tag for element type "action" must end with a '>' delimiter. issue 2 :   javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/struts-config.xml SOLUTION :-   One thing i know that  parsing error means that Struts couldn't parse one or more of config xml files. From the message, it sounds like the problem is in the  struts-config.xml; After doing long R&D, I found that i have done small mistake while configuring  struts-config.xml; My struts-config.xml :-  <action-mappings>         <action             path="/Welcome" type="*****.Action" scope="request" validate="true">             <forward name="success" path="/**.do?reqCode=**