Answer the question
In order to leave comments, you need to log in
How to handle empty DATETIM cell in mysql db in java?
There is a table in mysql database which has a DATETIME field. This field may be null. When I execute SELECT to this table and I receive the data in such a way
that at null in this field the error takes off. How to handle null datetime field? Date date = resultSet.getDate("date_birth")
Answer the question
In order to leave comments, you need to log in
Either check resultSet.getDate("date_birth") for null explicitly or use Optional from Java 8 if the project allows. Then everything will look like this:
Optional<Date> date = Optional.ofNullable(resultSet.getDate("date_birth");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question