Hi,
I need a database connection pool that can reconnect to a different 
replicated failover server if the main server stop working.  I found 
DButil SteadyDBConnection works great in transparently reconnect if the 
connection is lost, but to try a different server I'm trying some 
changes that incorporate some ideas from sqlalchemy pool.py.

Instead of pass as first arg of SteadyDBConnection a dbapi module should 
be possible also pass a callable function that must return a newly 
connected DBAPI connection object as in this example:

######
from DBUtils.PersistentDB import PersistentDB
import kinterbasdb

def getconn():
    try:
        conn = kinterbasdb.connect(dsn=dsn1,...)
    except kinterbasdb.OperationalError:
        conn = kinterbasdb.connect(dsn=dsn2, ...)
    return conn

persist = PersistentDB(getconn)
######

In the callable function we can implement also other nice things as load 
balancing.

I've just started with some changes in SteadyDBConnection.py and 
PersistentDB.py, and a very basic test seems to work, before I go on 
anyone has some ideas or is interested in look at my code?

Ezio Vernacotola



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to