You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Guillaume Barre <Gu...@technomedia.ca> on 2003/04/02 20:00:50 UTC

One object model vs multiple database

Hi ,

I am trying to use one object model with a various number of databases. My
application can create dynamically new databases

For example I use a Torque.properties file with two DB declarations like
this :

	torque.dsfactory.test1.factory =
org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory
	torque.dsfactory.test1.pool.defaultMaxActive = 10
	torque.dsfactory.test1.pool.testOnBorrow = true
	torque.dsfactory.test1.pool.validationQuery = SELECT 1

	torque.dsfactory.test2.factory =
org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory
	torque.dsfactory.test2.pool.defaultMaxActive = 10
	torque.dsfactory.tesy2.pool.testOnBorrow = true
	torque.dsfactory.test2.pool.validationQuery = SELECT 1

	torque.database.test1.adapter = mysql
	torque.dsfactory.test1.connection.driver = org.gjt.mm.mysql.Driver
	torque.dsfactory.test1.connection.url =
jdbc:mysql://127.0.0.1:3306/test1
	torque.dsfactory.test1.connection.user = root
	torque.dsfactory.test1.connection.password = 

	torque.database.test2.adapter = mysql
	torque.dsfactory.test2.connection.driver = org.gjt.mm.mysql.Driver
	torque.dsfactory.test2.connection.url =
jdbc:mysql://127.0.0.1:3306/test2
	torque.dsfactory.test2.connection.user = root
	torque.dsfactory.test2.connection.password = 
	...

My question is how dynamically add a third database without modifying this
file and restart all the application.
I tested using for a second time Torque.init(...) after having changed the
"Configuration" values but without success.

Maybe somebody knows a way to do that?

Thanks