I tried it on a rusty oil pan and it held for a while...
In your case, I assume you have an aluminum pan that cracked..
Drain the oil and put a quart of mineral spriits in the engine and let it seep out, to clean out the crack...then use the JB weld...
Or.. at the Home Depot they sell some plumbing epoxy stuff that works even under water or under pressure.. just be sure it is clean to start with.
Another thought is to solder it with an electric solder Iron..(not a gun).