You have to start a new configuration with
Configuration c = (Configuration)new
PropertiesConfiguration("Torque.properties");
Then change youtr properties and finally call
Torque.init(c);
At least that worked for me.

Gerhard Otte
__
mailto:[EMAIL PROTECTED]     emediapark GmbH http://www.emediapark.de
Tel:+49 (0)941 630804-2 Fax:-9  Hemauerstr.14,93047 Regensburg,Germany

-----Ursprüngliche Nachricht-----
Von: Jeremy Kincaid [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 27. November 2003 07:31
An: [EMAIL PROTECTED]
Betreff: How to dynamically add new database to Torque


        I am trying to find a way to dynamically add a new database to
Torque after it as already been initialized.  I tried retreiving the
configuration from Torque and then adding properties that would normally
have appeared in the torque.properties file, then called
Torque.init(configuration), or Torque.setConfiguration(configuration),
but these didn't work.  After looking at the source code, it was easy to
see why.  So does anyone have an alternative for the following:

Configuration config = Torque.getConfiguration();
//add adpater information
config.addProperty( "database.newDatabase.adapter", "mysql" );  
//add pooling information
config.addProperty( "dsfactory.newDatabase.factory",
"org.apache.torque.dsfactory.SharedPoolDataSourceFactory" );
config.addProperty( "dsfactory.newDatabase.defaultMaxActive", "10" );
config.addProperty( "dsfactory.newDatabase.testOnBorrow", "true" );
config.addProperty( "dsfactory.newDatabase.validationQuery", "SELECT 1"
);
config.addProperty( "dsfactory.newDatabase.connection.driver",
"org.gjt.mm.mysql.Driver" );
config.addProperty( "dsfactory.newDatabase.connection.url",
"jdbc:mysql://localhost:3306/NewDatabase" );

Torque.init( config );
Connection newConnection = Torque.getConnection( "newDatabase" );

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


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

Reply via email to