Resource references are used to obtain connector and database connections, and to access JMS connection factories, JavaMail sessions, and URL links.
The configuration file is the same for Web applications,
application clients, and EJB components. For example, you would
modify the ejb-jar.xml file to modify an EJB.
Adding or modifying a resource
reference
Display the Configuration tab.
Modify the reference tags of interest. For example:
<resource-ref id="HTMLGenerator105_jdbc_default"> <res-ref-name>jdbc/default</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref id="HTMLGenerator105_jdbc_JavaCache"> <res-ref-name>jdbc/JavaCache</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Name The partial JNDI name used in servlet and JSP code. Use the prefix mail/ for
JavaMail references, jdbc/ for data
source references, url/ for java.net.URL
references, and jms/ for javax.jms
references. For example, if your code refers to java:comp/env/jdbc/MyDatabase, enter jdbc/MyDatabase
.
Type Choose the type of resource:
javax.sql.DataSource for JDBC connections.
java.mail.Session for JavaMail sessions. See Chapter 5, “Creating JavaMail” for more information.
java.net.url for aliased URLs.
javax.jms.QueueConnectionFactory for JMS queue connection factories.
javax.jms.TopicConnectionFactory for JMS topic connection factories.
Sharing Scope Choose Sharable or Unsharable. By default, connections to a resource manager are sharable across EJBs in an application that use the same resource in the same transaction context.
The sharing scope is available only to Web applications
and EJB components.
Authentication Select the source of the authentication credentials:
Application – use the credentials configured for the connection cache.
Container – use the credentials of the caller who logged in to EAServer and created the component instance.
Resource Link Specify the resource link for the resource type:
javax.sql.DataSource – select the name of the EAServer connection cache or connector to be used for this resource.
java.mail.Session – specify the SMTP mail server for outgoing mail.
java.net.url – enter
the URL string, as it would be used to construct a java.net.URL instance
by calling the URL(java.lang.String) constructor.
URLs must contain a protocol and host address, for example: http://www.sybase.com
or ftp://pub.sybase.com
.
javax.jms.QueueConnectionFactory – select the name of the queue connection factory.
javax.jms.TopicConnectionFactory – select the name of the topic connection factory.
Click Apply.