Hi,

I can now reproduce this problem. It occurs in times zones were the
daylight saving time ends at midnight, for example Brasilia. There was
a similar problem for Chile before, but the exception in that case is
invalid HOUR_OF_DAY. A workaround for this problem is implemented. For
the timezone Brasilia, it looks like the exception is invalid
DAY_OF_MONTH for years larger than 2037.

A solution is to use hour 12 instead of 0. The only problem is that
casting a date to a timestamp will now use the hour 12 instead of 0
(midnight):

select cast(date '2042-10-12' as timestamp) from test;

will return 2042-10-12 12:00:00.0. For HSQLDB it returns 2042-10-11
23:00:00.0. Derby doesn't allow to cast a date to a timestamp, and
PostgreSQL and MySQL use hour 0 (they are not written in Java).

Also, if ResultSet.get...() returns a java.sql.Date, that will
sometimes not be equal to a Date generated with
java.sql.Date.valueOf(...). Not sure if this can be solved. By the way
java.sql.Date.valueOf("2042-10-12").toString() returns 2042-10-11 when
using the time zone Brasilia...

Regards,
Thomas




On Thu, Oct 30, 2008 at 12:07 PM, galmeida <[EMAIL PROTECTED]> wrote:
> Hi Thomas,
> I work with piercio (who reported this problem), I'm writing to say we
> can provide you any info, test cases, whatever you need to help us
> solve this problem, also if you prefer to use IM, i'm online on
> GoogleTalk (galmeida at letter a, number zero, letter z, dot, org) and
> AIM (GustavoFromHell), thank you very much.
>
> On Oct 29, 4:10 pm, "Thomas Mueller" <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>>
>> It works for me. Could you run this and post the result?
>>
>> System.getProperties().list(System.out);
>>
>> Thanks,
>> Thomas
>>
>> On Wed, Oct 29, 2008 at 6:01 PM, Piercio <[EMAIL PROTECTED]> wrote:
>>
>> > I am using H2 1.1.102 in embedded mode, and could not insert the date
>> > 2042-10-12 in the database.
>> > Using squirrel to connect, and running:
>>
>> > call date '2042-10-12';
>>
>> > resulted in the following error:
>>
>> > Error: Cannot parse date constant 2042-10-12, cause:
>> > java.lang.IllegalArgumentException: DAY_OF_MONTH; SQL statement:
>> > call date '2042-10-12' [90009-101]
>> > SQLState:  90009
>> > ErrorCode: 90009
>>
>> > It works for other dates such as 2041-10-11, 2042-10-13, 2041-10-12
>> > etc. It seems to happen only with this specific date.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to