Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 14667 invoked from network); 4 Aug 2005 14:26:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Aug 2005 14:26:03 -0000 Received: (qmail 1425 invoked by uid 500); 4 Aug 2005 14:25:59 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 1363 invoked by uid 500); 4 Aug 2005 14:25:59 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 1350 invoked by uid 99); 4 Aug 2005 14:25:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2005 07:25:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jmcnally@collab.net designates 64.125.134.138 as permitted sender) Received: from [64.125.134.138] (HELO laswell.sp.collab.net) (64.125.134.138) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 04 Aug 2005 07:25:46 -0700 Received: (qmail 8123 invoked from network); 4 Aug 2005 14:25:54 -0000 Received: from vpn1.sjc.collab.net (HELO ?204.11.125.128?) (204.11.125.128) by laswell.sfo.collab.net with SMTP; 4 Aug 2005 14:25:54 -0000 Message-ID: <42F2256E.8050102@collab.net> Date: Thu, 04 Aug 2005 09:25:50 -0500 From: John McNally User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en, ja, ko MIME-Version: 1.0 To: Jakarta Commons Developers List Subject: Re: [dbutils] SystemDataSource References: <20050804045535.92897.qmail@web50409.mail.yahoo.com> In-Reply-To: <20050804045535.92897.qmail@web50409.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Both of these suggestions are connection pooling datasources; or do they also provide a simple datasource? Jakarta Commons already has DBCP which offers a couple connection pooling datasources, no need to go looking to sourceforge. John McNally David Graham wrote: >Why not just use a real DataSource from C3P0 or Proxool? They're fully >featured and easy to setup. Also, we should not use properties named >jdbc.* as they are potentially used by drivers. > >http://sourceforge.net/projects/c3p0 >http://proxool.sourceforge.net/ > >David > >--- Henri Yandell wrote: > > > >>Just had need to hack together a simple DataSource class and wondered >>if it would fit nicely in dbutils. Name is either SystemDataSource >>(after SystemClassLoader) or DriverManagerDataSource, it uses Java -D >>properties and the DriverManager, so is very lightweight and something >>nice to start with before moving up to a container that supplies a >>real DataSource. >> >>I imagine there are MockDataSources out there that are similar too for >>unit testing, but nothing in DbUtils yet. >> >>(code follows, it's pretty dumb) >> >>public class SystemDataSource implements DataSource { >> >> private String driver = System.getProperty("jdbc.driver"); >> private String username = System.getProperty("jdbc.user"); >> private String password = System.getProperty("jdbc.password"); >> private String uri = System.getProperty("jdbc.uri"); >> >> public SystemDataSource() { >> DbUtils.loadDriver(driver); >> } >> >> public Connection getConnection() throws SQLException { >> return DriverManager.getConnection(this.uri, this.username, >>this.password); >> } >> >> public Connection getConnection(String username, String password) >>throws SQLException { >> return DriverManager.getConnection(this.uri, username, >>password); >> } >> >> public PrintWriter getLogWriter() throws SQLException { >> return DriverManager.getLogWriter(); >> } >> >> public void setLogWriter(PrintWriter logWriter) throws SQLException >>{ >> DriverManager.setLogWriter(logWriter); >> } >> >> public void setLoginTimeout(int timeout) throws SQLException { >> DriverManager.setLoginTimeout(timeout); >> } >> >> public int getLoginTimeout() throws SQLException { >> return DriverManager.getLoginTimeout(); >> } >> >>} >> >> > > >Get Firefox! >http://www.mozilla.org/firefox/ > > > >____________________________________________________ >Start your day with Yahoo! - make it your home page >http://www.yahoo.com/r/hs > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org