user manual
120 BES Developer’s Guide
Support of references and links
userTransaction.begin();
// locate the datasource using resource-ref name
Object resRef = context.lookup("java:comp/env/jdbc/
CheckingDataSource");
java.sql.Connection conn =
((javax.sql.DataSource)resRef).getConnection();
//do some database work.
userTransaction.commit();
...............
Support of references and links
During application assembly and deployment you must verify that all EJB and
resource references have been properly linked. For more information about
EJB and resource references, consult Sun Microsystem's EJB 2.0 and J2EE
1.3 specifications.
The Borland Enterprise Server client container supports the use of ejb-links. In
the case of a standalone JAR file, the ejb-links have to be resolved before the
JAR is deployed. There must be a JNDI name specified for the target bean in
the vendor-specific section of the client deployment descriptor.
For a client JAR that is part of an Enterprise Application Archive (EAR), the
JNDI name of the target EJB may live in a different ejb-jar. The client verify
tool checks that the target EJB with the name specified in the ejb-link tag
exists.
During runtime, the container resolves (locates) the target EJB corresponding
to the ejb-link name in the EAR and uses the JNDI name of the target EJB.
Note that application clients run in their own Java virtual machines. EJB-links
are not optimized for application clients like they are for EJBs referring to
another EJB located in the same container.
Keep the following rules in mind when working with EJB references and ejb-
links in deployment descriptors for application client containers:
1 An ejb-ref that is not an ejb-link must have an entry in a Borland-specific file
containing the JNDI name of the referenced (target) EJB.
2 An ejb-ref that has an ejb-link element must follow these rules:
■
If the ejb-ref is in a client JAR and is a standalone JAR, rule 1 applies.
That is, it should have a Borland-specific file with the JNDI name
resolved in the deployment descriptor within the (same) JAR.
■
If the ejb-ref is in a client-jar embedded in an application archive (an
EAR), the JNDI name of the target EJB is not required to exist in the
application-client-borland.xml file. In this case, the name in the ejb-link
element is composed of a path name specifying the fully qualified path to
the ejb-jar containing the referenced enterprise bean with the ejb-name
of the target bean appended and separated from the path name by "#".
The path name is relative to the JAR file containing the application client










