db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: openConnection dissapeared from BaseJDBCTestCase.java
Date Mon, 13 Nov 2006 23:04:08 GMT
Julius.Stroffek wrote:
> Hi All,
> I prepared a patch for DERBY-1434 with a test. I wanted to submit it 
> today, however when updated a trunk to the most recent version, the method
> openConnection(String databaseName)
> disaperead from the BaseJDBCTestCase.java.
> I need to create two connections to different databases in a test so the 
> openDefaultConnection() method is notsufficient. I think that probably 
> no tests used this method. How should I create these connections today? 
> Should I create the missing openConnection method?

I just added a utility method

JDBCDataSource.getDataSource(String dbName)

to obtain a connection to a different database, eg.

ds = JDBCDataSource.getDataSource("otherdb");
conn = ds.getConnection();

I'm using it for the database class loading test to obtain a connection 
to a database contained in a jar file.

The current setup is focused on a single database, I did a while back 
add a decorator to switch the default database & connection to a 
different "single use" database 

With a test that needs concurrent multiple open databases some thought 
on the setup is needed to ensure the extra databases are created and/or 
cleaned and shutdown at the end of the test. If multiple tests simply 
created their own databases and left them lying around then it would 
cause issues eventually.


View raw message