Getting Boolean from ResultSet

This should work:

    try (Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?serverTimezone=UTC");){

        // create table bool_table (bool_value boolean);
        // insert into bool_table values (null);
        String sql = "SELECT * FROM bool_table";

        try (PreparedStatement preStmt = conn.prepareStatement(sql)){

            try (ResultSet rs = preStmt.executeQuery()) {
                rs.next();

                System.out.println(rs.getObject(1, Boolean.class));
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
    } catch (SQLException ex) {
        ex.printStackTrace();
    }

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