Try catch for database access.