Thanks for responding Charles. I'm looking at the code here --> http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java?view=markup
<http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java?view=markup>According this code, the connection pool is not initialized until certain methods are called. Here's an excerpt: "Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: <code>getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter." So in my code I'm doing this: Context ctx = new InitialContext(); org.apache.tomcat.dbcp.dbcp.BasicDataSource ds = (org.apache.tomcat.dbcp.dbcp.BasicDataSource)ctx.lookup( "java:comp/env/jdbc/DB" ); // These must be set before the call to getConnection(), since getConnection actually creates the pool. ds.setDefaultCatalog( orgID ); ds.setUsername( orgID ); ds.setPassword( orgID ); connection = ds.getConnection(); // then call getConnection() which calls createDataSource(). This should return an existing connection in an extant pool, or create a new pool with username, password andcatalog as parameters for connection in the new pool. Won't this have the effect I'm looking for of creating a pool per database? If I'm misunderstanding could someone please walk me through were I'm going wrong? On Thu, Jul 1, 2010 at 3:06 PM, Caldarale, Charles R < chuck.caldar...@unisys.com> wrote: > > From: Andrew Laughlin [mailto:andrew.laugh...@gmail.com] > > Subject: Re: Implementing Connection Pooling > > > > The credentials for a database connection are specified per > > database. That is, user credentials are not used to get an > > authenticated connection to the database. Notice OrgID is > > the database name, username and password. > > You're not going to be able to do this with a single <Resource> element, > since one <Resource> == one connection pool. You'll either have to > configure one <Resource> per OrgID (and know them all up front), or use your > own connection pooling with commons-dbcp (or equivalent). > > - Chuck > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you received > this in error, please contact the sender and delete the e-mail and its > attachments from all computers. > >