On Thu, 2003-08-07 at 10:42, VanL wrote: > I am using quixote+mod_python as a front-end for a database app. I > would like the database connections to persist somewhere -- probably in > the interpreter attached to the apache process -- so that I do not have > to reconnect with each request. > > However, I am unsure how to do this, and how to then access that db > connection from quixote. Does anyone know how this is a accomplished? I'm using scgi, not mod_python, but have had success so far using Webware's DBPool.py (from the MiscUtils module): http://webware.sourceforge.net/Webware-0.8.1/MiscUtils/Docs/UsersGuide.html Someone suggested this on the list not long ago, and it indeed works quite simply. It's initialized in MySessionPublisher.__init__(): # ...please adjust for any odd indenting... self._dbpool = DBPool(MySQLdb, config.db_pool_size, config.db_host, config.db_user, config.db_passwd, config.db_name) ...which then also provides: def get_cursor (self): return self._dbpool.getConnection().cursor() ...so then, in .py or .ptl files: from quixote import get_publisher cursor = get_publisher().get_cursor() [cursor.whatever()] cursor.close() This setup appears to perform adequately under (simple!) load testing. I'm sorry I don't know whether this translates simply into mod_python; perhaps the initialization and get_cursor() could be fit into a subclassed ModPythonPublisher? Hope this helps, -Dan