Improvements to open and close data base connection.