Connection factory JNDI name practices
Observe the conventions of the JNDI service in WebSphere Application Server when we create connection factory JNDI names.
Distributed computing environments often employ naming and directory services to obtain shared components and resources. Naming and directory services use name-to-object mappings to associate names with objects such locations, services, information, and resources. The JNDI provides a common interface used to access the various naming and directory services.
Naming your resources indirectly
When creating a connection factory or data source, a JNDI name is given by which the connection factory or data source can be looked up by a component. WAS uses an indirect name with the java:comp/env prefix:
- When we create a WAS data source, the default JNDI name is set to jdbc/data_source_name.
- When we create a connection factory, its default name is eis/j2c_connection_factory_name.
If we override these values by specifying our own, retain the java:comp/env prefix. An indirect name makes any resource-reference data associated with the application available to the connection management runtime, to better manage resources based on the res-auth, res-isolation-level, res-sharing-scope, and res-resolution-control settings.
Naming your resources for use with CMP
In addition, if you click the checkbox for the Use this data source for container managed persistence (CMP) option when we create the data source, another reference is created with the name of eis/jndi_name_of_datasource_CMP. For example, if a data source has a JNDI name of jdbc/myDatasource, the CMP JNDI name is eis/jdbc/myDatasource_CMP. This name is used internally by CMP and is provided simply for informational purposes.
Related:
Data sources