Medication with codeine in it is very effective for earaches. My daughter's doctor prescribed it for her one time. She stopped crying and went to sleep twenty minutes after taking it.
I can't use anything with codeine though, so I usually use a heating pad on my ear when I have an earache. If that doesn't work, I head to the doctor because I'm prone to ear infections and those only go away with antibiotics.