Q:

MySQL DB or JDBC driver not handling LocalDate.MAX

I am trying to run a query with a start date and end date as parameters, which may be null. 
MySQL - the DB or the JDBC driver or in combination - cannot handle null values by which I mean, the SQL AND endDate <= null excludes every row. 
So I am trying to use startDate >= LocalDate.MIN which works well for the "no start date".
But endDate <= LocalDate.MAX doesn't work to allow any date. This is the SQL template:
String strStmt = "SELECT d.forecastId, d.valueDate, d.value " +
        "FROM data d " +
        "WHERE d.forecastId = ? " +
        "AND valueDate >= ? " +
        "AND valueDate <= ? " +

and this is the variable allocation:
if (startDate == null) {
    statement.setObject(2, LocalDate.MIN);
} else {
    statement.setObject(2, startDate.toInstant().atZone(
            ZoneId.systemDefault()).toLocalDate());
}
if (endDate == null) {
    statement.setObject(3, LocalDate.MAX);
} else {
    statement.setObject(3, endDate.toInstant().atZone(
            ZoneId.systemDefault()).toLocalDate());
}
try (ResultSet rs = statement.executeQuery()) { 
...

and this is the SQL which it produces (via P6Spy): 
SELECT valueDate FROM data d WHERE d.forecastId = 52010 
AND valueDate >= '-999999999-01-01' 
AND valueDate <= '+999999999-12-31'

This doesn't work, I get no rows. 
If I then change it to something less extreme:
if (endDate == null) {
    statement.setObject(3, LocalDate.parse("2019-01-01"));
...

I see the following in the P6Spy logging:
SELECT valueDate FROM data d WHERE d.forecastId = 52010 
AND valueDate >= '-999999999-01-01' 
AND valueDate <= '2019-01-01'

and the query works fine, except of course at some point in the future.
Is this some sort of overflow in MySQL? Should I use LocalDate.MAX differently or what can I use instead of LocalDate.MAX?
I don't wish to revert to 
    statement.setDate(3, new java.sql.Date(Long.MAX_VALUE); 

which produces the following:
AND valueDate <= '17-Aug-94'

which doesn't work either - maybe a Y2K or Year 2038 bug? P6Spy is not helping by displaying it with its own unhelpful format. 

A:

Exceeding limits of the data type DATE in MySQL
The data type DATE in MySQL 5.7 is limited to a much smaller range of values than the java.time.LocalDate type. Quoting from that doc, (emphasis mine):

The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

In contrast, java.time.LocalDate.MAX is the date +999999999-12-31. The year 999999999 is well beyond the year 9999.
If your goal is recording a particular date far in the future as a stand-in for an unknown or indeterminate date, choose one not quite so far out. Or use NULL, but neither Dr. Chris Date nor I recommend using NULL.
Date-time capabilities vary widely amongst various databases. The SQL standard barely touches on the subject. So you must carefully read the documentation of your particular database to learn the limits and the behavior of that product. Likewise, your JDBC driver.

