Hello Guy,
Thank you for posting your solution,
I am using Torque 3.1 and I just had a look at Torque.java. I didn't spot any re-entrancy problems there. We really just need this feature during the test phase. I have only one login at application start and from then on the application accesses the same DB.
As far as I can see your changeDbHost(...) would do the trick!
Thanks again, Tarlika
Guy Galil wrote:
We change database host as well as other properties at runtime. We are using an old version of Torque - 3.02 In order to achieve this I had to modify org.apache.torque.Torque.java so that it is re-entrant and added a reConfig(Configuration c) method. Then in my code I created a utility class that can be used to change the configuration at runtime:
public static void changeDbHost(String logicName, String host) throws TorqueException { Configuration config = Torque.getConfiguration(); replaceProperty(config,URL.replaceAll("logic_name",logicName),"jdbc:mysql://"+host+"/TURBINE"); Torque.reConfig(config); }
public static void replaceProperty(Configuration config, String key, String value) { if(config.containsKey(key)) config.setProperty(key, value); else config.addProperty(key, value); }
--
Regards/Gruß,
Tarlika Elisabeth Schmitz
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]