Show TOC Start of Content Area

This graphic is explained in the accompanying text Example: Describing Data Sources in the web-j2ee-engine.xml  Locate the document in its SAP Library structure

We want to use a data source with a custom resource name.

In the ...

       1.      In the data-sources-aliases.xml in the external archive, the data source is described with an alias which will serve as a resource name.

       2.      In the web-j2ee-engine.xml in the Web application, we map the data source alias to the new resource name.

       3.      In the web.xml in the Web application, we describe the resource reference using the new resource name.

       4.      In the source code of the Web application, we get the data source using JNDI lookup.

The lookup string we use starts with java:comp/env, which is the standard prefix for looking up resources, and finishes with the new resource name.

The following graphic illustrates the above steps, the relations between the components, and the exact source code extracts.

This graphic is explained in the accompanying text

Recommendation

We recommend that you use the naming convention for specifying the lookup name in <res-ref-name>. For each factory type there is an appropriate prefix meant to be used as follows:

       jdbc/ for a JDBC javax.sql.DataSource factory

       jms/ for a JMS javax.jms.QueueConnectionFactory or javax.jms.TopicConnectionFactory

       mail/ for a JavaMail javax.mail.Session factory

       url/ for a java.net.URL factory

End of Content Area