Torque run time supports multiple database configuration but not at "generation" time. Here is the quote from that tutorial: "It is worth re-iterating that these run-time properties are not used by Torque when generating your object model and creating your database. They are used only by the application utilizing the Torque-generated object model classes at run-time."
My understanding of Martin's request is that he wants to generate sql scripts at build time, not run time. My own experience was to use torque-jdbc task to generate om classes for different databases. So instead of editing build-torque.properties for different databases, what I did was to create a master build-torque.properties file, with tokens for database name, user-name, password etc. Something like this: torque.database.createUrl = @DATABASE_URL@ torque.database.buildUrl = @DATABASE_URL@ torque.database.url = @DATABASE_URL@ torque.database.driver = @DATABASE_DRIVER@ torque.database.user = @DATABASE_USER@ torque.database.password = @DATABASE_PASSWORD@ torque.database.host = @DATABASE_HOST@ torque.database.schema = @DATABASE_SCHEMA@ torque.database.name = @DATABASE_NAME@ And then create a filter file for each database, with values for those tokens. Something like this: DATABASE_URL = jdbc:mysql://10.1.1.1:3306/xxxxx DATABASE_DRIVER = org.gjt.mm.mysql.Driver DATABASE_USER = xxxxx DATABASE_PASSWORD = xxxxx DATABASE_HOST = 10.1.1.1 DATABASE_SCHEMA = xxxxx DATABASE_NAME = xxxxx Then in your build.xml, you can do this: <target name="torque-jdbc-filter" if="torque.jdbc.filtersfile"> <delete file="build-torque.properties"/> <filter filtersfile="${torque.jdbc.filtersfile}"/> <copy file="build-torque-master.properties" tofile="build-torque.properties" filtering="true"/> <antcall target="torque-jdbc"/> </target> When you call ant, you can specify which filter file to use (as a property). For the sql task, it didn't use so many properties (I think only ${torque.database} is relevant) so you only need to use one token. Let me know if there are any simpler ways to do this. Now in the torque 3.1 development version, generation part is separated from run time but I'm not sure if it supports multiple databases. Howard Lin > -----Original Message----- > From: Eric Emminger [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 12:06 PM > To: Turbine Torque Users List > Subject: Re: Configuration for different databases > > > Martin and Howard > > Please, correct me if I'm wrong, but I'm pretty sure you CAN > do this in > Torque without special Ant stuff. I believe it would look like the > following. > > torque.database.mysql=yourdb > torque.database.mysql.username=mysqluser > torque.database.db2=yourdb > torque.database.db2.username=db2user > . . . > > See the tutorial. > http://db.apache.org/torque/tutorial/step2.html > > Eric > > >>I am searching for a simple way for handling different database > >>configurations with one configuration file. > > > --------------------------------------------------------------------- > 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]