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