Probably one of the top 5 questions I get asked on consulting gigs is, "How do I connect to an external database?"
I'm sorry that it is not prettier and not more well-organized. I'll have to pretty it up later, and make it more Wiki-ish. But I just wanted to get the info out there. Also, maybe I will rewrite it to put the service layer in the actual plugin. Enjoy.