[Zope] Managing a pool of database connections

David Mitchell djmitchell at optushome.com.au
Wed Dec 3 05:45:48 EST 2003


Hello list,

I have a bunch of Postgres databases, containing archived data.  The 
number of databases is growing over time, and already numbers several 
thousand.

I want to give my Zope users the ability to do the following:
- specify a database to connect to
- select from a list of "lookup" values for certain fields in that database
- search the database for data based on the entered "lookup" values
- display the results

The only part I'm having trouble with is the first step.  I don't want 
to pre-define thousands of database connections, and have to continually 
add new connections - most of the databases will only be accessed 
rarely, so creating all those database definitions would constitute a 
significant time and resource drain.

What I'd like to do is:
- user enters a database name
- a new Zope database connection gets created programmatically, pointing 
to the requested database (how do I do this???)
- using this database connection, we look for data in several tables and 
present the results as "lookup" values
- user searches for data
- results displayed
- user disconnects, times out or logs out
- database connection gets closed

Is it possible to create and destroy database connections in Zope like 
this, and if so, what's the best way to go about it?

Regards

Dave Mitchell




More information about the Zope mailing list