Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 67670 invoked from network); 27 Apr 2006 08:46:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Apr 2006 08:46:31 -0000 Received: (qmail 75946 invoked by uid 500); 27 Apr 2006 08:46:29 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 75928 invoked by uid 500); 27 Apr 2006 08:46:28 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 75917 invoked by uid 99); 27 Apr 2006 08:46:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2006 01:46:28 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [217.72.192.234] (HELO fmmailgate03.web.de) (217.72.192.234) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Apr 2006 01:46:27 -0700 Received: by fmmailgate03.web.de (8.12.6/8.12.6/webde Linux 0.7) with ESMTP id k3R8k5hB016664 for ; Thu, 27 Apr 2006 10:46:05 +0200 Received: from [217.91.91.39] (helo=LT002) by smtp08.web.de with asmtp (TLSv1:RC4-MD5:128) (WEB.DE 4.107 #108) id 1FZ28T-0002zZ-00 for user-java@ibatis.apache.org; Thu, 27 Apr 2006 10:46:05 +0200 From: "Norbert Rieger" To: Subject: Connecting to db with user/password not from database.properties Date: Thu, 27 Apr 2006 10:46:45 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal Sender: norbert-rieger@web.de X-Sender: norbert-rieger@web.de X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I want to connect to my database with a username/password which can not be put into a property file, it will be given by an user input. So the tag in sql-map-config.xml can't be used. How can I specify these values in my java file (iBATIS-API) ? I tried: Properties props = new Properties () ; props.setProperty ("url", "jdbc:postgresql://server/appl-db") ; props.setProperty ("driver", "org.postgresql.Driver") ; props.setProperty ("username", ".....") ; props.setProperty ("password", ".....") ; String resource = "webapps/base/persistence/dao.xml"; Reader reader = Resources.getResourceAsReader(resource); return DaoManagerBuilder.buildDaoManager(reader, props); but I think the "props" for buildDaoManager are not what I'm looking for, iBATIS always takes the JDBC parameters (url,driver,user,pwd) from the property file, if omitted I get an error message: ERROR [http-80-Processor21] - SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: driver java.lang.ClassNotFoundException: driver I think this is because "${driver}" can't be replaced and therefore it evaluates to "driver". sql-map-config.xml: How can I specify my (dynamic) JDBC parameters at runtime ? Any help is appreciated. Thanx a lot Norbert