I believe ear infections are usually treated with antibiotics.
Antibiotics are a form of prescription medication that can be obtained from your doctor or pharmacist.
The one thing I'd recommend is that you are very careful how much you rely on antibiotics.
This is because bacteria reproduce at a very high rate, and the more antibiotics you throw at them, the more likely they are to mutate and adapt to become resilient to the treatment. This could create a very serious situation where the antibiotics you are using to treat an infection become ineffective!