properly open and close db connection....