Hi, I am currently doing a little web-based project of my own and have some trouble comparing a java.util.date with an oracle Date field. It gives the error that SQL command is not properly ended when I try to do so:
java.util.Date newDate=new java.util.Date(); ResultSet rset = stmt.executeQuery ("SELECT DISTINCT issue_dt FROM passcard WHERE passcard.expire_dt>"+newDate);
Have tried formatting it with: SimpleDateFormat sdf=new SimpleDateFormat("d-MMM-yy"); as the db format is 7-MAY-04, but that doesn't seem to work as yy is recognised as an illegal character in the database.Thanks in advance and would be grateful for any help given
It sounds like a problem with SQL syntax rather than anything to do with Java directly. You might want to try adding a semi-colon to the end of your SQL query:
Also, you may need to use SimpleDateFormat.format() in order to actually format the date into a String in the correct format for your database.
p.s. We have a database forum here at the Saloon where such questions are more appropriate. In fact, the people there probably will be able to answer your questions a lot better than I can. [ November 30, 2004: Message edited by: Layne Lund ]