Error(140,19): method setDate(int, java.util.Date) not found

I am using jdbc to update database. I am using the following code

String sql ="Update Employees set " +

"FirstName = ?, " +

"LastName = ?, " +

"HireDate = ?, " +

"ReportsTo = ? " +

"where EmployeeID = ?";

try{

PreparedStatement pstmt = con.prepareStatement(sql);

pstmt.setString(1,empObj.getFirstName());

pstmt.setString(2,empObj.getLastName());

pstmt.setDate(3,empObj.getHireDate());

pstmt.setInt(4,empObj.getReportsTo());

pstmt.setInt(5,empObj.getEmployeeId());

pstmt.executeUpdate();

I am getting compiler error for the pstmt.setDate(3,empObj.getHireDate());

Here is the error

Error(140,19): method setDate(int, java.util.Date) not found in interface java.sql.PreparedStatement

What is wrong with the code?

[1040 byte] By [Jatin_Kulkarnia] at [2007-11-26 18:01:39]
# 1
The reason is that setDate function takes java.sql.Date instead of java.util.Date
gssa at 2007-7-9 5:31:17 > top of Java-index,Java Essentials,New To Java...
# 2
How do I solve this problem?
Jatin_Kulkarnia at 2007-7-9 5:31:17 > top of Java-index,Java Essentials,New To Java...
# 3
Shall casting it to sql type work ?
Jatin_Kulkarnia at 2007-7-9 5:31:17 > top of Java-index,Java Essentials,New To Java...
# 4
I get a class cast exception if I cast it to sql type. How will this work then.
Jatin_Kulkarnia at 2007-7-9 5:31:17 > top of Java-index,Java Essentials,New To Java...
# 5
I have solved the problem with code given belowjava.sql.Date sqlDate;sqlDate = new java.sql.Date(empObj.getHireDate().getTime());Then use the sqlDate in pstmt.setDate(3,sqlDate);thanks and regards,Jatin
Jatin_Kulkarnia at 2007-7-9 5:31:17 > top of Java-index,Java Essentials,New To Java...