From: Ian Sparks <Ian.S<parks@et...> - 2003-10-14 20:05:25
Thanks for this feedback.
In my code its possible that several folks might add a new dbPool at the =
same time so I think :
jackson.py #couldn't resist
poolLock =3D Lock()
if not clientpool.has_key(new_name):
clientpool[new_name] =3D DBPool(...)
Also, not quite sure what's going to happen if I want to delete a pool =
from the dictionary (databases sometimes go away). Any way to find out =
if a dbPool is busy?
From: Aaron Held [mailto:aaron@...]
Sent: Tuesday, October 14, 2003 3:44 PM
To: Ian Bicking
Cc: Ian Sparks; Webware-Discuss (E-mail)
Subject: Re: [Webware-discuss] dbPools dictionary
I have something like this running on a production system w/out any =
clientpool['testing']=3DDBPool(PgSQL, 2, 'localhost::testing:me:pass')
clientpool['metrony']=3DDBPool(PgSQL, 2, 'localhost::me:pass')
I have also loaded the server:database:user:pass string from a database:
sql =3D '''select "companyname" , "dsnPool" from companies where =
> 0 '''
for r in rall:
clientpool[r.companyname.strip()]=3DDBPool(PgSQL, 5, dsn)
Ian Bicking wrote:
> On Tuesday, October 14, 2003, at 11:57 AM, Ian Sparks wrote:
>> I have a need to register connections to databases on an ad-hoc=20
>> basis. To do this I was thinking of adding a dbPools dictionary=20
>> somewhere in my application.
>> Instead of doing a dbPool.getConnection() I'd do :
>> Question : Is this safe?
> The threadsafeness depends more on where you set dbPools['conn1']. If =
> that is threadsafe, then getting a connection from there should be=20
> Ian Bicking | ianb@... | http://blog.ianbicking.org
> This SF.net email is sponsored by: SF.net Giveback Program.
> SourceForge.net hosts over 70,000 Open Source Projects.
> See the people who have HELPED US provide better services:
> Click here: http://sourceforge.net/supporters.php
> Webware-discuss mailing list
"I don't know what's wrong with my television set. I was getting
C-Span and the Home Shopping Network on the same station.
I actually bought a congressman."
- Bruce Baum