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 = Lock()

servlet somewhere:

import jackson

poolLock.aquire()
try:
  if not clientpool.has_key(new_name):
          clientpool[new_name] = DBPool(...)
finally:
        poolLock.release()

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?


-----Original Message-----
From: Aaron Held [mailto:[EMAIL PROTECTED]
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 issues.

clientpool['testing']=DBPool(PgSQL, 2, 'localhost::testing:me:pass')
clientpool['metrony']=DBPool(PgSQL, 2, 'localhost::me:pass')

I have also loaded the server:database:user:pass string from a database:

conn=datapool.getConnection()
c=conn.cursor()
sql = '''select "companyname" , "dsnPool" from companies where "active" 
 > 0 '''
c.execute(sql)
rall=c.fetchall()
for r in rall:
    clientpool[r.companyname.strip()]=DBPool(PgSQL, 5, dsn)

-Aaron


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 
>> basis. To do this I was thinking of adding a dbPools dictionary 
>> somewhere in my application.
>>
>> Instead of doing a dbPool.getConnection() I'd do :
>>
>> dbPools['conn1'].getConnection()
>>
>> 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 
> threadsafe.
>
> -- 
> Ian Bicking | [EMAIL PROTECTED] | 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
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss


-- 
-Aaron
http://www.MetroNY.com/
"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





-------------------------------------------------------
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
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to