Yes if you REMOVE both from the battery and touch them together with even just a small gauge wire it should kill any memory in the ECM
I dont think disconnecting the battery or even 50 cycle ignition can erase the code in OBD2, it work for the older car and truck below 1997 or 1996 but not after.Anyway the code will reappear again and again if you do not fix the real problem.