Hallo,
Uzo Uzo hat gesagt: // Uzo Uzo wrote:

> I have a Shop Context
> 
> in its __init__.py I initalized DBPool
> 
> from MiscUtils.DBPool import DBPool
> from pyPgSQL import PgSQL
> 
> def contextInitialize(appServer, path):
>         # Set up DBpool startup and shutdown - 7/6/03
>         appServer._dbpool = DBPool(PgSQL, 5,
> 'localhost::foodb:foouser:')
>         print "Database Connection Pool successfully
> created."
>        
> appServer.addShutDownHandler(appServer._dbpool.shutDown)
> 
> Now from one of my Servlets
> I try to get a connection but it fails, I have tried
> appServer._dbpool.getConnection() and
> _dbpool.getConnection() but it always bombs out 


I *think*, DBPool wants to be a global instance. So your code has to
be: 

#---- MyDataPool.py
from MiscUtils.DBPool import DBPool
from pyPgSQL import PgSQL

global_dbpool = DBPool(PgSQL, 5, 'localhost::foodb:foouser:')

#---- __init__py
from MyDataPool import global_dbpool

def contextInitialize(appServer, path):
        # Set up DBpool startup and shutdown - 7/6/03
        appServer._dbpool = global_dbpool.getConnection()
                print "Database Connection Pool successfully asked for
                connection."
       
ciao
-- 
 Frank Barknecht                               _ ______footils.org__


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to