David Geller
dg at sponsera.com
Sat Nov 27 12:35:37 EST 2004
I was noticing in the FAQ on maintaining a persistent MySQL DB connection, that while there is a single global db connection, on each request a new call to db.cursor() is made. What are the advantages/disadvantages to making the cursor global as well and using the same cursor for each request? Also, since the db connection is never explicitly closed, will it be closed when/if the apache process dies? (mpm = prefork) David Nick wrote: > That was me. I would recommend keeping the global in the module > namespace that contains your handler code. You can check every request > to see if you're still connected. Also, see the FAQ for a more complex > setup: > > http://modpython.org/FAQ/faqw.py?req=show&file=faq03.003.htp > > Nick > > On Fri, 2004-11-26 at 14:39 -0700, Trevor West wrote: > >>When I was asking about my database problems. Someone mentioned to me >>that they kept a single global database connection and just pulled >>cursers off that. And while I know how to do that in the context of a >>thick client add (we build a big app with wxPython), I'm not sure how to >>keep globals in apache other than using the session. I've seen lots of >>examples on the web but none of it seems to make much sense... >> >>Cheers >> >>Trevor >>_______________________________________________ >>Mod_python mailing list >>Mod_python at modpython.org >>http://mailman.modpython.org/mailman/listinfo/mod_python
|