This should work:
try (Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?serverTimezone=UTC");){
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();
}
source
share