Menu

#288 cannot configure DatasourceDatabaseTester

closed
Bug (232)
5
2010-05-13
2010-04-28
Anonymous
No

The way DatasourceDatabaseTester implements getConnection() is by creating a new object each time:
public IDatabaseConnection getConnection() throws Exception
{
logger.debug("getConnection() - start");

    assertTrue\( "DataSource is not set", dataSource\!=null \);
    return new DatabaseConnection\( dataSource.getConnection\(\), getSchema\(\) \);
\}

Calling getConfig() on the returned object will then have no effect since the next call to getConnection() (by the framework) will get a completely new object, which will obviously not have your customizations.

Is this as simple as caching the IDatabaseConnection in that tester?

Discussion

  • matthias g

    matthias g - 2010-04-28

    Hi,
    I recommend to overwrite the "getConnection" method and set the config there. This should work for you. Even though its not very beautiful
    Rgds,
    matthias

     
  • matthias g

    matthias g - 2010-04-28
    • status: open --> pending
     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.