run this function passing db object as attr.