All topics are described in the provided link.
In the web.xml a resource reference has to be described like following:
<resource-ref> <res-ref-name>jdbc/DefaultDB</res-ref-name> <res-type>javax.sql.DataSource</res-type></resource-ref>
The connection is then established via a "javax.sql.DataSource" object.
InitialContext ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DefaultDB");
Please simply read the example, then you will understand the process.