Oracle timestamp insert problem [message #473845] |
Wed, 01 September 2010 02:27 |
lalit.thawani
Messages: 11 Registered: April 2007
|
Junior Member |
|
|
Hi !
I am working on to upgrade the oracle client from 10G to 11G on the HP-UX 11.31.
The problem that i am facing is related to timestamp. The timestamp values that gets logged in using 10G client is in GMT.( I use the java flag -Doracle.jdbc.V8Compatible=true to make it happen).
Since i upgraded to 11G client all the timestamp logging is in local time, which is a problem.
Is there a way i could continue timestamp logging in GMT?
Thanks
Lalit
|
|
|
Re: Oracle timestamp insert problem [message #475220 is a reply to message #473845] |
Mon, 13 September 2010 14:34 |
lalit.thawani
Messages: 11 Registered: April 2007
|
Junior Member |
|
|
Ok ! Got the resolution.
It looks like the behavior of PreparedStatement.setTimeStamp () api is changed with the 11G client.
Until 10G this api call works fine
dbPreparedStatement.setTimestamp(memberIndex++, dbTimeStamp);
and it sets the timestamp in the zone in which the dbTimeStamp is defined. (can be GMT/PST etc).
Now with 11G this call does not work at it is. It needs an extra calendar object as a parameter to work.
Calendar gmtCal = Calendar.getInstance();
dbPreparedStatement.setTimestamp(memberIndex++, dbTimeStamp, gmtCal);
This code change resolves the issue for me.
Thanks
Lalit
|
|
|
|