I am working with JDBC and MySQL. I have a date column that I need included in my result set. Unfortunately, I cannot find a class in Java to retrieve the date. The SQL Date class is deprecated. How do you get Date objects from a result set?
Share
You use java.sql.Date. A constructor and some methods are deprecated. The class isn’t. Confused by this versus, say, java.util.Date or java.util.Calendar? Look at Making Sense of Java’s Dates.
There are three JDBC date/time types:
The confusion probably arises from the fact that java.sql.Date extends java.util.Date and thus inherits its deprecated methods.
Just use the right type for the type of your column.