This works for me (also using Oracle)
java.text.SimpleDateFormat dfDB = new
java.text.SimpleDateFormat("yyyy.MM.dd.hh:mm:ss");
java.util.Date dToday;
dToday = new java.util.Date();
String sSQL;
sSQL += "TO_DATE('"+dfDB.format(dToday)+"','YYYY.MM.DD.HH:MI:SS'),";
----- Original Message -----
From: "Albert Yip" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 24, 2001 9:33 PM
Subject: Prepared Statement and date
> Hi all,
>
> Just wondering about how should I deal with dates when trying to insert
data
> into db with prepared statements. I tried to use strings like "2001-05-16
> 10:10:10" but it keeps giving me error:
>
> java.sql.SQLException: ORA-01861: literal does not match format string
>
> any ideas? I would really appreciate it if someone can give a hand.
>
> Thanks,
> Albert
>
>
___________________________________________________________________________
___________________________________________________________________________
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