user manual
Chapter 12: The VisiClient Container 119
Document Type Definitions (DTDs)
<description>
reference to a jdbc datasource mentioned down in the DD section
</description>
<res-ref-name>jdbc/CheckingDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref></application-client>
Example of a vendor-specific file:
<?xml version="1.0"?>
<!DOCTYPE application-client PUBLIC "-//Borland Corporation//DTD J2EE
Application Client 1.3//EN"
"http://www.borland.com/devsupport/appserver/dtds/application-client_1_3-
borland.dtd">
<application-client>
<ejb-ref>
<ejb-ref-name>ejb/Sort</ejb-ref-name>
<jndi-name>sort</jndi-name>
</ejb-ref>
<resource-ref>
<res-ref-name>jdbc/CheckingDataSource</res-ref-name>
<jndi-name>file:///net/machine/datasources/OracleDataSource</jndi-name>
</resource-ref>
</application-client>
For more information about environment entries, ejb-refs, or resource-refs,
see the relevant sections of Sun Microsystem's EJB 2.0 specifications at
www.java.sun/com/j2ee.
Sample code
This example shows the usage of the logical local JNDI naming context. It
shows how a client uses the deployment descriptors specified in the preceding
section.
// get a JNDI context using the Naming service and create a remote object
javax.naming.Context context = new javax.naming.InitialContext();
Object ref = context.lookup("java:comp/env/ejb/Sort");
SortHome home = (SortHome) javax.rmi.PortableRemoteObject.narrow(ref,
SortHome.class);
Sort sort = home.create();
// get the value of an environment entry using JNDI
Object envValue = context.lookup("java:comp/env/myStringEnv");
System.out.println("Value of env entry = "+ (java.lang.String) envValue
);
// locate a UserTransaction object
javax.transaction.UserTransaction userTransaction =
(javax.transaction.UserTransaction) context.lookup("java:comp/
UserTransaction");










