Error - java.sql.Timestamp cannot be cast to java.sql.Date in JFreeChart
java, jfreechart, sql
Solution
Date date = new Date(((Timestamp)resultSet.getObject(column)).getTime());
Problem
While i'm retrieving data from my database to add to a chart using JFreeChart I get the error: ``` java.sql.Timestamp cannot be cast to java.sql.Date ``` I have four columns the first three are retrieved properly using a case but while going through the final column it goes to the correct case: ``` case Types.TIMESTAMP: { ``` But then the error occurs on this part: ``` Date date = (Date) resultSet.getObject(column); ``` The data within the database is formatted like this (HH,MM,SS). Edit - Also would like to add this class is included with the JFreeCharts API - JDBCCategoryDataset.java