Bug #13704 setting zeroDateTimeBehavior in my.ini causes MySQL to not load
Submitted: 3 Oct 2005 9:39 Modified: 3 Oct 2005 14:19
Reporter: James Katz Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:4.1.12a OS:Windows (WinXP Pro)
Assigned to: CPU Architecture:Any

[3 Oct 2005 9:39] James Katz
Description:
When I add the configuration variable zeroDateTimeBehavior to the my.ini file in the mysqld section, the service will not start. Setting it to either convertToNull or round has the same affect.

How to repeat:
add line zeroDateTimeBehavior=convertToNull to my.ini file in mysqld section
[3 Oct 2005 10:40] Valeriy Kravchuk
Would you, please, give me a URL to the MySQL manual where it says something about "zeroDateTimeBehavior configuration variable"? I do not know such a server variable really. So, why do you think you can specify it in the [mysqld] section of your my.ini file?
[3 Oct 2005 13:32] James Katz
The zeroDateTimeBehavior is documented in this document:MySQL Connector/J Documentation
by Mark Matthews
[3 Oct 2005 14:19] Valeriy Kravchuk
You mean that one (http://dev.mysql.com/doc/mysql/en/cj-upgrading.html):

"Connector/J 3.1 throws an exception by default when these values are encountered as this is the most correct behavior according to the JDBC and SQL standards. This behavior can be modified using the 'zeroDateTimeBehavior' configuration property. The allowable values are: 'exception' (the default), which throws a SQLException with a SQLState of 'S1009', 'convertToNull', which returns NULL instead of the date, and 'round', which rounds the date to the nearest closest value which is '0001-01-01'."

Then, as a configuration property, it has nothing to do with [mysqld] and any other section of my.ini file. Keep reading the manual (http://dev.mysql.com/doc/mysql/en/cj-configuration-properties.html):

"Configuration properties define how Connector/J will make a connection to a MySQL server. Unless otherwise noted, properties can be set for a DataSource object or for a Connection object.

Configuration Properties can be set in one of the following ways:
    - Using the set*() methods on MySQL implementations of java.sql.DataSource:
          - com.mysql.jdbc.jdbc2.optional.MysqlDataSource
          - com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
    - As a key/value pair in the java.util.Properties instance passed to DriverManager.getConnection() or Driver.connect()
    - As a JDBC URL parameter in the URL given to java.sql.DriverManager.getConnection(), java.sql.Driver.connect() or the MySQL implementations of javax.sql.DataSource's setURL() method."

So, that is how to set it.