Documentation Home
Connectors and APIs Manual
Download this Manual
PDF (US Ltr) - 4.5Mb
PDF (A4) - 4.5Mb


3.5.6.3 Handling of YEAR Values

How a value in a MySQL YEAR column is handled is controlled by the connection property yearIsDateType:

Connector/J follows the same rules that govern how values are inserted by a mysql client; see explanations in The YEAR Type for details.

Connector/J handles the retrieval of zero values from a YEAR column differently than a mysql client. Treatments of zero values depend on whether they are strings or numbers, and on the value of yearIsDateType:

  • If a string value of '0', '00', or '000' is entered into a YEAR column, when retrieved by Connector/J:

    • If yearIsDateType is true, the retrieved value is equivalent to January 1, 2000 00:00:00.000.

    • If yearIsDateType is false, the retrieved value is 2000

  • If a numeric value of 0, 00, 000, or 0000 is entered into a YEAR column, when retrieved by Connector/J,

    • If yearIsDateType is true, the retrieved value is equivalent to January 1, 2000 00:00:00.000.

    • If yearIsDateType is false, the retrieved value is 0