File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes compile error ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "compile error ? " Watch "compile error ? " New topic
Author

compile error ?

Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
Hey guys! I get the following compile error when I try to run the below referenced code:

com\chicken\DoIt2.java:88: cannot find symbol
symbol :method setDate(int,java.util.Date)
location: interface java.sql.PreparedStatement
in.setDate(1, previousDate);

I can't figure this out. I've looked at the javdocs, etc.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18125
    
    8

That method takes a parameter of type java.sql.Date, not java.util.Date.
Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
Thanks Paul!

I should have paid closer attention. Now I need to figure out how to parse my initial date.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18125
    
    8

Just take the java.util.Date object which you already have, and convert it to a java.sql.Date object. You'll find that java.sql.Date does have a suitable constructor.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compile error ?
 
Similar Threads
Comparing two date inputs
problem in incrementing date
Date; Previous date, Calendar; Gregorian
org.hibernate.exception.GenericJDBCException: could not insert:
overloading question