Search code examples
javamysqlsqlresultset

Getting Boolean from ResultSet


ResultSet#getBoolean seems to return false when it's null.
Is there an easy way to get a Boolean (not boolean) from a ResultSet?


Solution

  • You can call wasNull after calling getBoolean. It's explained here: https://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#wasNull%28%29