Yeah. Something like this I think: * Have PoolingDataSource and PoolingDriver contain a KeyedObjectPool rather than simply an ObjectPool, using the (possibly null?) uname/passwd pair as the key.
* Make PoolableConnectionFactory implement KeyedPoolableObjectFactory rather than simply PooledObjectFactory (as you mention, you could extend BaseKeyedPoolableObjectFactory to do this) * add a createConnection(uname,passwd) to the ConnectionFactory interface (perhaps also createConnection(Properties) or whatever other factory methods make sense), and implement it for the relevant children So that PoolingDataSource.getConnection(uname,passwd) can invoke pool.borrowObject(new Pair(uname,passwd)), which in turn will invoke ConnectionFactory.createConnection(uname,passwd). I suspect there are a few other issues lurking about (PoolableConnection will have to change to make sure it returns itself to the right keyed-pool, etc.), and glancing over it it's a little more complicated than I remembered it, but I think that's basically it. -----Original Message----- From: Randy Speh [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 10:30 AM To: Jakarta Commons Developers List Subject: RE: DBCP PoolingDataSource So it looks like I need to extend and implement BaseKeyedPoolableObjectFactory. Does that seem correct? Thanks, Randy Speh --- "Waldhoff, Rodney" <[EMAIL PROTECTED]> wrote: > > Are there plans to make the PoolingDataSource > support > > the getConnection(user, pwd) method? > > It's a little bit tricky since it's the > ObjectPool/ConnectionFactory that > actually creates the Connections, so there's > currently no direct way for the > PoolingDataSource to pass the arguments down to the > DataSourceConnectionFactory. One way to do it would > be to use a > KeyedObjectPool instead of ObjectPool, and pass the > username/password pair > (or in the case of the PoolingDriver, the Properties > object) as the key. > > I might play around with that if I get a chance, but > it'll probably be a few > days before I do, so don't let that stop you if > you've got an itch for it. > > - Rod > > > Thanks, > > Randy Speh > > __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
