Atomikos Forum |
|
My application uses two datasources: a Spring DriverManagerDataSource for unit testing in a J2SE environment, and a datasource provided by the application server (JBoss 5.1) when running in a J2EE environment. I would like to switch to an AtomikosNonXADataSourceBean for unit testing and an AtomikosDataSourceBean for production. However, after changing my Spring configuration file, I received the dreaded "Session Time Zone not set" errors while reading columns defined as 'timestamp with local timezone'.
I solved this problem while unit testing by subclassing the DriverManagerDataSource class and calling setSessionTimeZone manually. The problem did NOT occur in production (I assume that JBoss was calling setSessionTimeZone internally somewhere). Is there any easy way to set the session timezone using the Atomikos datasources? I don't feel bad about my subclass 'hack' for unit testing, but don't really want to bring it into production.
You could try to set a testQuery on the datasource that executes some SQL to do this:
see http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_2012.htm HTH |