Re: Timestamps and Oracle
Re: Timestamps and Oracle
- Subject: Re: Timestamps and Oracle
- From: Alexis Tual <email@hidden>
- Date: Tue, 13 Mar 2012 10:12:04 +1100
Thanks for your answer, that eases things with this setup.
But in our case, we should store dates in our timezone because DB is accessed by other means and I found the problem !
The timezone was specified in litteral "Pacific/Noumea" which seems to confuse Java, by changing it to GMT+11, all is sweet :
- dates are saved in GMT+11 representation
- dates are read as GMT+11 without any conversion
Cheers,
Alex
2012/2/26 Alexander Spohr
<email@hidden>
We always store times without any time zone in the database. WO and Java use UTC and the client then converts that to local time (whatever that is).
Just works (for us).
atze
Am 23.02.2012 um 02:32 schrieb Alexis Tual:
> Hi list,
>
> looks like moving to GMT+11 timezone gives you a nice sun in february but also headache with oracle and timezones.
> The application, the db and the users are in the same timezone (GMT+11), we set this in the Application constructor with the NSTimeZone.setDefault, TimeZone.setDefault, even -Duser.timezone=....
> Now here's the problem :
> - the user enters a date, for example 21/02/2012 23h59 which is stored in Java as 21/02/2012 12h59 (GMT).
> - the jdbc driver (ojdbc5.jar Oracle JDBC Driver version - "11.1.0.7.0-Production") converts the date to 21/02/2012 23h59
> - the db sets the column (of type DATE) : set my_date = '21/02/2012 23h59'
> "UPDATE IP_DATES_OUVERTURE_DOM SET IP_DATES_FIN_DOM = ? WHERE (...)" withBindings: 1:2012-02-21 23:59:00(ipDatesFinDom)
> - the user request the same date
> - the jdbc driver fetch the date as 21/02/2012 23h59 (no tz info at this level)
> - the adaptor creates a NSTimestamp with 21/02/2012 23h59 (GMT)
> - the formatter (configured with tz = GMT+11) shows : 22/02/2012 10h59 ...
>
> Something is obviously wrong with this setup, either :
> - the jdbc driver should not convert to GMT+11 when inserting, the db then stores only GMT dates
> - the jdbc driver or the adaptor should convert back to GMT when reading the date from the DB
>
> Any hint is welcomed,
>
> Thanks !
>
> Alex
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden