persistent db connection

implemented a persistent database connection