giving error with setDate

When i am trying to update a date field in Database its giving Error as:

"The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, Date)"

I have written following code in JSP, This code is running fine for the string and integer data types using setString() and setInt() methods

what changes should i make to update date field in database.

Below is my code

PreparedStatement pstm;

pstm=c.prepareStatement("insert into table1 values(?,?)");

Date dt= new Date(dt.getTime());

//or Date dt = new SimpleDateFormat("MM/dd/YYYY").parse("20/05/1999");

pstm.setString(1,"abcd");

pstm.setDate(2,dt);

[708 byte] By [Atmaling_Kshirsagara] at [2007-11-27 5:29:00]
# 1
does the table you are trying to update only contain two fields? If not, then you have yo specify which fields you are trying to query. Example:Table emp's columns:fname, lname, address_id, dob...etcINSERT INTO EMP (fname, dob) VALUES (?,
kdajania at 2007-7-12 14:51:48 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Make sure your Date object is a java.sql.Date object and not a java.util.Date object.
masijade.a at 2007-7-12 14:51:48 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...