List:MySQL and Java« Previous MessageNext Message »
From:Rich Collins Date:December 17 2004 9:39pm
Subject:Re: ResultSet.getTimestamp throws exception for 0000-00-00 00:00:00
in 3.1 gamma
View as plain text  
Mark,

This is not for one application.  Its for many applications that all 
connect to their own respective MySQL databases.  In addition, some of 
the web applications were created before the developers new about 
connection pools.  Instead they used properties files for each 
individual webapp.  I have it all straight for new applications.  But I 
can't just support only the new applications; I have to support them all.

Rich

Mark Matthews wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Rich Collins wrote:
>  
>
>>Ken,
>>
>>Actually the database field is usually a DATETIME.  The getTimestamp was 
>>used to return the second information as well.  I know that NULL should 
>>have been used. Unfortunately it was (out of my control) not, so now I 
>>have to work with what exists.  As a result of the (non-backward 
>>compatible) change in the behavior of Connector-J, I will have to do 
>>some major refactoring of our systems.  Either catching the exception 
>>and setting the variable to null, or changing the properties used 
>>(zeroDateTimeBehavior=convertToNull) to connect to the database 
>>everywhere a connection is made.  Neither one sounds good to me.
>>
>>I realize that the proper way is to use NULL values.  Unfortunately we 
>>(as well as many others) came to rely on a loosely implemented feature 
>>that has now been "corrected" with the end result of breaking a fair 
>>portion of our code.
>>
>>Thanks,
>>
>>Rich
>>
>>Ken Johanson wrote:
>>
>>
>>    
>>
>>>Couple quick thoughts:
>>>
>>>
>>>      
>>>
>>>>Rich,
>>>>
>>>>If you want to represent NULL, why not use NULL, and use DATETIMEs
>>>>instead of TIMESTAMPS?
>>>>
>>>>
>>>>   -Mark
>>>>        
>>>>
>>>-Yes, it seems that null should work, but many API cant deal with a 
>>>null input (a null Timestamp) so the user has to cheat the database 
>>>into returning something. This is really the APIs fault IMO, and the 
>>>driver should stick to spec.
>>>
>>>Yes, I belive by its nature TIMESTAMP shouldbe used here - the correct 
>>>behavior of a DB is to update a timestamp any time the rows changed or 
>>>created (not sure MySQL does this by default when creating a timestamp 
>>>column) - so it shouldnt be null anyway. A datetime could be though.
>>>
>>>thoughts,
>>>ken
>>>      
>>>
>
>Rich,
>
>You've got more serious problems than zero date times if your
>connections are configured in more than one place in your
>application...Maybe it's time to fix that first? A good tool with
>refactoring support like Eclipse makes that a relative quick fix.
>
>	-Mark
>
>
>- --
>Mark Matthews
>MySQL AB, Software Development Manager - Client Connectivity
>Office: +1 408 213 6557
>www.mysql.com
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.6 (GNU/Linux)
>Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
>iD8DBQFBw1DftvXNTca6JD8RAtGdAJ4wWPFu5lXTGJ/s4Q4SUbSZ7bvAHQCeIb+6
>DjCwnS9JHtwxKGX/WVslxi8=
>=LzVQ
>-----END PGP SIGNATURE-----
>
>  
>
Thread
ResultSet.getTimestamp throws exception for 0000-00-00 00:00:00 in3.1 gammaRich Collins17 Dec
  • Re: ResultSet.getTimestamp throws exception for 0000-00-00 00:00:00in 3.1 gammaMark Matthews17 Dec
    • Re: ResultSet.getTimestamp throws exception for 0000-00-00 00:00:00in 3.1 gammaKen Johanson17 Dec
      • Re: ResultSet.getTimestamp throws exception for 0000-00-00 00:00:00in 3.1 gammaRich Collins17 Dec
Re: ResultSet.getTimestamp throws exception for 0000-00-00 00:00:00in 3.1 gammaRich Collins17 Dec