I don't think this will work with older tracs (< 1.0).  It seems that each of 0.11, 0.12 and 1.0 prefer a different means of getting a db connection (though later versions do have some backwards compatibility with earlier styles.) 

Ref: http://trac.edgewall.org/wiki/TracDev/DatabaseApi.