Enterprise beans and Web components can access a wide variety of
resources, including databases, mail sessions, Java Message
Service objects, and URLs.
You can download
code
samples from the Java Series book
The J2EE Tutorial: Resource Connections. There is resource
connection code in the /examples/src/ejb/confirmer/ConfirmerBean
and /examples/src/ejb/htmlreader/HTMLReaderBean classes.