I had a UTI earlier in this pregnancy and they gave me something called Keflex, it cleared me up and I had no side effects. I'm deathly allergic to penicillin so I couldn't have that, but I would definitely go directly to OB as they are specifically trained in the area of prenatal care.
You can tell your OB what the dentist prescribed and if he doesn't like it then he, himself, can prescribe something different. I was in the same position with my last pregnancy, but I don't remember what my ob prescribed at the time.
I was recently in the exact same position, i prescribed a 5 day course of amoxycillin by the dentist who was aware of my pregnancy and assured me it was safe to take, pain and infection gone and my baby is fine :) I'm at 28 weeks. Ask a doc as opposed to a nurse, no offence to nurses but GPs have a better understanding of prescribing. Good luck x