Re: [SQLObject] mysql connection losses
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: David W. <da...@su...> - 2004-03-18 17:39:59
|
Ian, > That seems like it might be problematic. For instance, what if rollback > is a no-op or something? It shouldn't be, but I wouldn't feel confident > that there's not a hidden corner case in the semantics. Agreed. It is one of those times when the db api spec compared to the jdbc spec is a bit frustrating. >> Otherwise it will need to do it in the db specific classes eg for >> mysql there is conn.ping() for mysql see >> http://www.esrf.fr/computing/bliss/python2/MySQL/MySQLdb-2.html > > That looks like the right thing to use. Doing it in a database-specific > way is no problem. It just requires an additional method call in > getConnection (say, pingConnection), which by default is a no-op, and we > override it for the various databases. I like this. This also allows for another option in the future which is a background thread that slowly loops through the pool testing and refreshing the connections. It is more code but can help responsiveness in situations where you have long periods with little activity and then a burst. With the test only when you ask for a connection you could find that in a burst of activity all connections are failing the tests and so you have not benefited at all from the pool. Regards Dave -- David Warnock, Sundayta Ltd. http://www.sundayta.com iDocSys for Document Management. VisibleResults for Fundraising. Development and Hosting of Web Applications and Sites. |