is a 2007 ecm compatible to a 2012 sentra?
Generally, no. ECM are "parts specific" and need to be encoded to the car they are installed in. Of course if the cars are identical in every way then they can share ECMs but that is rare. With your being 5 years apart I would doubt they are identical enough to share an ECM.
Search Nissan Sentra Questions
Nissan Sentra Experts