I have a timestamp column in a mysql table. I am unable to retrieve this value from java.sql.ResultSet using getTimestamp(String label).
ResultSet rs = preparedStatement.getResultSet();
rList = new ArrayList<String>();
while (rs.next() != false){
rList.add(rs.getString("urlstring"));
if (rs.getTimestamp("mytimestamp") == null) {
rList.add("null");
} else {
rList.add(rs.getTimestamp("mytimestamp").toString());
}
}
I can confirm that there are results in the resultset. When I omit the statements which attempt to retrieve the timestamp from the resultset, the list populates as expected, however, when I run the above code, there is no error but the list is empty.