Changed the way connection to database is used in DAO classes