Instead of trying to match the database's format, it's simpler to create a
PreparedStatement then use the setDate method to insert a Date object in the
database.
    (*Chris*)

PreparedStatement stm = con.prepareStatement("update employees set
terminationdate=? where firstname='Luke' and lastname='Skywalker');
stm.setDate(new Date());
stm.executeUpdate();
stm.close();

----- Original Message -----
From: Duke Martin <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 23, 1999 4:10 PM
Subject: anyone willing to help with servlet-mysql problem?? if not don't
answer


> hi,
>
> i have a java servlet that communicates with a mysql database. i also use
> javamail.   i retrieve the date from the message in the inbox, place in in
> the "yyyy-MM-dd HH:mm:ss" format using SimpleDateFormat and attempt to
> update the database with
> this value.  The date column on the database is of DATETIME format, which
> should be the same as i have shown above.  Whenever I try to update the
> database with a new date, the record is not updated.  Why is this?
>
> I have printed the value of the date to the screen and verified that it is
> in the proper format.
>
> Duke
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to