Here's what I have:
A "Store" module (not MiddleKit, home-brewed) that contains a class,
"Store":
-->Store.py:
dbpool = DBPool.DBPool(....)
class Store:
def __init__(self, ...):
self.conn = dbpool.getConnection()
self.cursor = self.conn.cursor()
...
-------
Then my SitePage:
-->Sitepage.py
class SitePage(Page):
def __init__(self):
self.store = Store.Store()
--------
Now, what I am worried about is: does this setup create one DBPool for the
entire WK server? For each instance of each servlet? for each servlet?
I.e., I am concerned about the number of threads I initialize dbpool with.
Again, the issue here is that I can't follow the threads code. Maybe I
should pick up a book and start reading :-)...
Thanks,
Costas
>From: Chuck Esterbrook <[EMAIL PROTECTED]>
>To: "Costas Malamas" <[EMAIL PROTECTED]>,
>[EMAIL PROTECTED]
>Subject: Re: [Webware-discuss] DB Connection Pulling
>Date: Fri, 3 May 2002 07:51:30 -0700
>
>On Friday 03 May 2002 06:55 am, Costas Malamas wrote:
> > Well, I am convinced, I'll go ahead and try it out.
> >
> > What I am not following from the docs though is how do you use
> > DBPool; I am not familiar with threading (at all!), so I don't get
> > the setup. E.g. do you call DBPool once in your application (somehow
> > have a central DBPool that you get connections from) or do can you
> > call it whenever you need a connection and it will "know" which
> > connection to give back? I am guessing the former --in which case,
> > where in WK is the best place to put it? subclass Application?
>
>Every time you think of subclassing Application just to store
>application wide resources, you could just as easily (or more easily)
>get along with a module for this purpose and put the objects in module
>level variables.
>
>This might also lead to further uses of that module in other settings.
>
>Surprisingly, there is not yet a Wiki page on this that I see.
>
>Looking back at the MiddleKit code that uses the DBPool, it simply gets
>a connection like this:
> conn = self._pool.getConnection()
>
>So as you guessed, you ask the pool for a connection whenever you need
>one. When you lose the reference to the connection, it will go back in
>the pool for other threads to use.
>
>Maybe the doc string needs further improvement.
>
>
>-Chuck
>
>_______________________________________________________________
>
>Have big pipes? SourceForge.net is looking for download mirrors. We supply
>the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
>_______________________________________________
>Webware-discuss mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/webware-discuss
_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss