I have a spring/jdbc/oracle 10g application. The Oracle server database timezone is set to GMT + 2 JVM timezone is GMT + 2 (even though it doesn't matter in my case).
I have a stored procedure that performs some date operations. The problem is that session timezone is different(GMT) than database timezone even though I do not set session timezone explicit in my code/configuration.
As far as I know the session timezone is by default equal to database timezone. Any idea why is the session timezone different than database timezone or how can I configure it in spring configuration (org.apache.commons.dbcp.BasicDataSource) ?
Thank you.
The correct way is to use
DelegatingDataSource
, retrieveOracleConnection
object from the original data source and callOracleConnection.setSessionTimeZone()
with the appropriate parameter.C3P0 code looks like:
I solved this problem by upgrading Oracle's JDBC drivers from v10.2.0.1.0 to v11.2.0.3. No changes to my java code were required.
Source: Spring forums.
In spring configuration, add below VM options before running the application:
Also make sure your pom has latest jdbc driver