Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set connection session time zone while using Datasource.

666425Oct 24 2008 — edited Oct 27 2008
Hi

We are using TIMESTAMP WITH LOCAL TIMEZONE as a datatype for few columns in one of our table.
While fething the records from this table using Spring JDBC we are getting following exception.
This happens while fetching the colums data from the resultset.

[10/24/08 9:53:33:121 EDT] 00000024 SystemErr R org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call odb_owner.od_cu_time_management_pg.sps_get_todyas_time_entry(?, ?, ?, ?)}]; SQL state [null]; error code [0]; Session Time Zone not set!; nested exception is java.sql.SQLException: Session Time Zone not set!
Caused by: java.sql.SQLException: Session Time Zone not set!
at oracle.jdbc.driver.TimestampltzAccessor.getTimestamp(TimestampltzAccessor.java:271)

The session time zone can be set only by extracting the native connection using NativeJdbcExtractorAdapter.
Is there any other way we can set the session time zone for the datasource based on user locale/time zone.
As using the native extractor could cause connection leak as the connection also needs to be closed.

Please suggest a way how to deal with TIMESTAMP WITH LOCAL TIMEZONE.

Thanks
Ravi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2008
Added on Oct 24 2008
2 comments
16,031 views