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.

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:


Guy Pardon Send private email
Thursday, December 03, 2009

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.

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