On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote: > > why not simply? > > db.commit() > db.close() > > if db in an on object attribute like self.db you can do > > if self.db: > self.db.commit() > self.db.close() > self.db = 0 > > you can also do: > > BaseAdapter.close_all_instances('commit') >
This is not enough, as was documented on issue http://code.google.com/p/web2py/issues/detail?id=731<http://code.google.com/p/web2py/issues/detail?id=731#c4>. The code that works for me for sqlite is as follows: def closebase(base): if not base: return # see: http://code.google.com/p/web2py/issues/detail?id=731 # see: https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion # was: base._adapter.close() from gluon.dal import thread thread.instances.remove(base._adapter) base._adapter.close() and then I call closebase(db); db = None which is enough for me with sqlite -- but apparently, the original poster has tried that, and that is not sufficient for mysql.