OBD stands for On Board Diagnostics. The 95 has OBD1 and the 97 is OBD2, so therefore they aren't compatible since the sensors are different for each. What you can do is use all of the external components for the 95's motor along with all of the sensors and install them into the 97 motor. The actual motor itself is the same, Just the sensors and how they are read are different.
'87 YJ, 4.2L built and bored, 8" of lift, 8.8 rear, AX15/NP 231J, Tom Woods drive shafts, Flat fenders, 12,000LB winch, Custom bumpers, Rattle can paint job. Never completed...