Magnus, without looking at the code or API, I agree with what you've got
mentioned here. I will examine it more closely as time allows. Patches
welcome, of course. ;)
Magn�s ��r Torfason wrote:
>
> It seems to me that there must be a bug in the interaction between the
> PoolBrokerService and the ConnectionPool:
>
> public DBConnection getConnection(
> String driver,
> String url,
> String username,
> String password )
> {
> ...
> pool = (ConnectionPool) pools.get(url);
> ...
> return pool.getConnection(driver, url, username, password);
> }
>
> The pools are indexed by url only, NOT by username and password.
> I also checked if pool.getConnection(driver,url,username,password) would
> possibly handle this, but they don't. What happens is that if a connection
> for another username exists, it (a connection with the incorrect user) is
> returned.
>
> This can be fixed by adding the username to the key of the pools Hashtable
> (driver and password may safely be left out):
>
> pool = (ConnectionPool) pools.get(url + username);
>
> <MyTwoCents>
>
> What bothers me is that the ConnectionPool.getConnection(...) method even
> takes the database parameters. If instead the creator took the parameters
> and saved them as instance variables, and the getConnection function took no
> parameters, this bug would probably not have been introduced to the system.
>
> A similar thing applies to the PoolBrokerService itself. Why isn't there a
> method like this in there:
>
> public void registerPool(String poolname, String driver, String url, String
> username, String password)
>
> The PoolBrokerService.getConnection(...) method would then not need to take
> the database parameters, only the name of the pool. This would be a lot
> cleaner. I have nothing to gain from having driver/url/username/password
> accessible everywhere in the system, much better to give each pool a
> meaningful name, and reference it by that.
>
> The modifications are minor, and I can submit a set of patches. The old
> functions can even stay, one could choose which version to use.
>
> </MyTwoCents>
>
> More to come, on a related subject.
--
Daniel Rall <[EMAIL PROTECTED]>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]