Re: [c3p0-users] Handling Multiple Databases
Status: Beta
Brought to you by:
swaldman
From: Norman E. <nor...@gm...> - 2009-06-11 20:01:48
|
Call me crazy, but I may have found an even simpler way. It looks like if I just call .setJdbcUrl() on my ComboPooledDataSource, it calls a softReset (technically, this.resetPoolManager(false)) and reinitializes the pool. Do you see any problems just changing the URL and marching on? Thanks, Norman On Thu, Jun 11, 2009 at 2:08 PM, Steve Waldman<swa...@mc...> wrote: > In terms of overhead, I'd think that next to tearing down the Connections, > tearing down the DataSource is pretty much negligible. And you want to tear > down the Connection -- you said you'd prefer not to maintain the overhead of > several unused pools (that would be the fastest approach, but would use a > bit more memory and network resources). Alternatively you could keep several > DataSources open, and just set minPoolSize=1, letting the pool grow when you > shift from one DB to the next. > > But my guess is the simplest solution, tear down and recreate, will be best > unless you are switching databases with great frequency. If minPoolSize > isn't huge and you don't switch more often than say once in 10 mins, I think > the benefits of simplicity are likely to overwhelm any small gains in > efficiency. (If you are switching frequently, don't softReset() either, cuz > you'll incur the overhead of all the Cxn destruction and recreation. If you > need to shift constantly, then you do need to keep a set of DataSources live > and active.) > > smiles, > Steve > > |