Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Data access resources > Develop data access applications > Develop data access applications > Benefits of resource references > Requirements for setting data access isolation levels
Data source lookups for enterprise beans and web modules
During either application assembly or deployment, bind the resource reference to the Java Naming and Directory Interface (JNDI) name of the actual resource in the runtime environment. We can take this action in the assembly tool or as one of the steps during installation of the application enterprise archive (EAR) file.
Bean-managed persistence bean
When developing your bean-managed persistence (BMP) bean you generally lack knowledge about the name of the data source on the target application server. In your code, do not look up the data source directly. Instead, you look up the resource reference from the java:comp/env namespace file. Let us assume that you look up the resource reference named ref/ds as illustrated in the code below.
javax.sql.DataSource dSource = (javax.sql.DataSource)((new InitialContext()).lookup("java:comp/env/ref/ds"));In the assembly tool, you specify the name ref/ds in the Resource Reference page on the General Tab. If you know the name of the data source you can specify it in this Resource References page on the Bindings Tab. Note that if you do not specify it here , you must provide this JNDI name when you install the application EAR file.
Container-managed persistence bean
The data source binding process for the container-managed persistence (CMP) bean is the same process that you perform for bean-managed persistence (BMP) beans. Use the data source JNDI name as a WebSphere binding property for each bean during application assembly.
Servlets and JSP Files
In a servlet application, you look up the data source exactly as you look it up in the BMP bean case.
Data sources
Unshareable and shareable connections
Configure a JDBC provider and data source using the JMX API
Configure data access for the Application Client
Create or changing a resource reference
Assembling data access applications
Migrate applications to use data sources of the current Java EE Connector Architecture (JCA)
Configure a JDBC provider and data source