r8962: properly handle object creation, close datatabase after use