Johannes Erdfelt
johannes at erdfelt.com
Thu May 2 20:16:08 EST 2002
On Thu, May 02, 2002, Javier Quinteros <jquinte at fadu.uba.ar> wrote: > I have seen an example in the FAQ to share the connection to the Database > between many modules using a global variable. I was trying to do the same but > I realize that a new connection is established every time I click a link. All > works fine until all the job is done and I return apache.OK. After that, the > variable holding my DB Connection seems to get lost and I have to connect > again. Someone told me that I should use any module that let me share memory. > That's ok and I've done that too, but everyone uses pickle to convert the > object to a string. The matter is that Connection Objects cannot be converted > by pickle. Does any of you have any idea, please? The problem is that Apache forks off a number of children to handle all of the requests. It's probably not forgetting the value, it's just that you're hitting a new Apache child. Using the code in the FAQ, you'll have one database connection per child maximum, which is usually reasonable. JE
|