Connecting to PostgreSQL from Tomcat 7 on OpenShift

I'm using a free OpenShift account to host a small site, and had some trouble getting a connection to my PostgreSQL cartridge from my Tomcat 7 (JBoss EWS 2.0) cartridge. As often happens, the act of asking the question made me think of a few additional solutions to explore, but I ended up posting the question then heading to OpenShift's support page to send a question. Like StackOverflow, OpenShift's contact page starts suggesting articles when you type in a subject, and that's how I found the article that describes their JNDI DataSources exposed by Tomcat.