Jacob Hanson said:
> It seems like dbPool ought to be able to trap an error like this
> gracefully and seamlessly open new, replacement connections without
> notice. At least that's what I would expect it to do. Maybe it still
> needs a bit of work?

I think it does.  I needed a database connection pooling mechanism for a
non-webware python project at work some time ago and, having seen dbPool
discussions on this list, I decided to give it a look.

The implementation is fairly simple and that is a good thing.  However, I
didn't like the fact that there was no provision whatsoever for dealing
with connections that may not be good anymore and I also didn't like the
way it "pre-allocated" the pool.  I wanted something that would be able to
grow on-demand up to some optional pre-defined limit.

After a few attempts to hack dbPool to do what I wanted, I ended up
writing my own pooling module.  To solve the idle-timeout problem, I
implemented a couple timestamp attributes in the class that wraps the
connection and actually stored the wrapper in the pool instead of the
underlying connection.  One of the attributes gets set when the wrapper is
instantiated and the other is set each time the __getattr__ method is
called.  The pool starts a thread when it is instatiated that periodically
cycles through all of the connections in the pool and "expires" them based
on either their age or idle-time.

I'm still not completely happy with it, but it seems to work fine for my
project.

Unfortunately, the code belongs to my employer and I am not at liberty to
share it without a lot of hassle that I frankly don't have time to deal
with right now.  I have wanted to rewrite it on my own time and try it out
with webware, but as yet have not been able to.

Perhaps someone can use my ideas and update dbPool or write a replacement.

-- 
Warren Smith
[EMAIL PROTECTED]




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to