Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 46727 invoked from network); 9 Aug 2004 14:00:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Aug 2004 14:00:57 -0000 Received: (qmail 10321 invoked by uid 500); 9 Aug 2004 14:00:56 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 10282 invoked by uid 500); 9 Aug 2004 14:00:56 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 10268 invoked by uid 99); 9 Aug 2004 14:00:55 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received: from [212.67.96.160] (HELO msgdirector4.onetel.net.uk) (212.67.96.160) by apache.org (qpsmtpd/0.27.1) with ESMTP; Mon, 09 Aug 2004 07:00:53 -0700 Received: from bolek.coachhouse (213-78-98-28.friaco.onetel.net.uk [213.78.98.28]) by msgdirector4.onetel.net.uk (MOS 3.4.6-GR) with ESMTP id CCL37609; Mon, 9 Aug 2004 15:00:49 +0100 (BST) Received: (Exim 3.36) #1 (Debian)) protocol: esmtp id 1BuAcD-00049T-00 ; Mon, 09 Aug 2004 14:55:05 +0100 Message-ID: <41178239.5070604@numerixtechnology.de> Date: Mon, 09 Aug 2004 14:55:05 +0100 From: T E Schmitz Reply-To: mailreg@numerixtechnology.de User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: torque-dev@db.apache.org Subject: Re: Specify hostname upon DB connect References: <41124D1B.2070205@numerixtechnology.de> <1091811331.4523.32.camel@guy.guardium.com> In-Reply-To: <1091811331.4523.32.camel@guy.guardium.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello, I tried to implement a reconfiguration of Torque at runtime following the advice Guy Galil kindly provided below. I just changed the URL but I didn't manage to get this change to take effect: Configuration config = Torque.getConfiguration(); config.setProperty(urlKey, newValue); Torque.setConfiguration(config); What do I need to do to get the new config property value to take effect using Torque 3.1? Regards, 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); > } > This works well for me. > I understand that Torque changed since the version I use and my > modifications to Torque.java are either not needed or not compatible > with the latest code, I am willing to send my Torque.java if you are > interested. > Guy > > On Thu, 2004-08-05 at 11:07, T E Schmitz wrote: > >>Hello, >> >>I would like to be able to specify the host (not just >>dbname/user/pasword) in a login dialog. I can't see how that could be >>done other than maybe via Torque.getConfiguration(), where I guess I'd >>find the URL. -- Regards/Gru�, Tarlika Elisabeth Schmitz --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org