Adam Jenkins wrote:
I have a test case where, in the setUp method, I create a hypersonic
database (random dbalias), run the table set up scripts, run my tests
(using dbunit) then, in the tearDown method I swap out the descriptor
and delete the database in preparation for the next test.

I'm having a problem where the JdbcConnectionDescriptor is successfully
replaced (I can see the one to the new dbalias being loaded), however
when I apply the scripts it tries to apply to the previous database (I'm
guessing it's pulling a connection from the pool that is still
associated with the old database?)...both JdbcConnectionDescriptor
objects are associated with the same jcdAlias.

You are hitting a problem with the way Connection pools are beeing cached in memory in OJB 1.0.x (this has been slightly refactored in OJB 1.1).

In order to clear the connection factory completely, you have to do
something like this (hack warning, ugly cast follows):

 ConnectionManagerIF cman = broker.serviceConnectionManager();
 broker.close();
 ConnectionFactory cf = ((ConnectionManagerImpl) 
cman).getUnderlyingConnectionFactory();
 cf.releaseAllResources();

I assume that you use the default ConnectionFactoryPooledImpl.

In your tests, you can also try switching to ConnectionFactoryNotPooledImpl,
giving you less troubles with cached Java-references in memory but poor
performance since every Connection object is created and destroyed
for every pool operation.

HTH,
 Martin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to