aspose file tools*
The moose likes JDBC and the fly likes Ambiguous class problem - NEED HELP QUICK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Ambiguous class problem - NEED HELP QUICK" Watch "Ambiguous class problem - NEED HELP QUICK" New topic
Author

Ambiguous class problem - NEED HELP QUICK

James Hewitt
Greenhorn

Joined: Jul 09, 2001
Posts: 27
I have created a servlet which enters html form input into a db2 database, and it is all working nicely with integer values. However, I want to perform some date and time calculations calculations on the form input, for which I need the Date class. To perform the sql needed for the database entry, I "import java.sql.*;". In order to perform the date calculations, I "import java.util.*;". The date calulations work fine in a servlet which does not have java.sql imported. However, when I try to put this calculation into the database entry servlet, I get
"Ambiguous class: java.util.Date and java.sql.Date"
removing "import.java.util.*;" means that it cannot compile the Date class. How can I solve this? I just want to get rid of it using the java.sql Date class.
Thanks in advance,
James
Julio Lopez
Greenhorn

Joined: Nov 14, 2000
Posts: 28

I am guessing you are getting this error on compilation. If you want to avoid this explicitly state what sort of Object each variable is. For example,
java.sql.Date aDate = ...
java.util.Date anotherDate = ...
instead of
Date aDate = ...
Date anotherDate = ...
Hope this helps,
Julio Lopez
James Hewitt
Greenhorn

Joined: Jul 09, 2001
Posts: 27
Yep, problem solved.
Thanks,
James
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Ambiguous class problem - NEED HELP QUICK