Added exception handling for DB connection