Atomikos Forum

Session TIme Zone not set

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.
dn Send private email
Wednesday, December 02, 2009
 
 
Hit post a little too soon :)

Just for curiosities' sake, I also set up my unit test to use the XA-enabled AtomikosDataSourceBean, and the same error occurred.

I am using an Oracle database.

Thanks,
Dan
dn Send private email
Wednesday, December 02, 2009
 
 
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
Guy Pardon Send private email
Thursday, December 03, 2009
 
 
Apologies,

I guess my suggestion above would not work since the SQL required is not a query...

I will create an issue to allow non-query SQL strings in a next release.

HTH
Guy Pardon Send private email
Sunday, December 06, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics