Connection factory JNDI name practices

Observe the conventions of the Java™ Naming and Directory Interface (JNDI) service in WebSphere® Application Server when you 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 Java Naming and Directory Interface (JNDI) provides a common interface that is 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. WebSphere Application Server uses an indirect name with the java:comp/env prefix:
  • When you create a WebSphere Application Server data source, the default JNDI name is set to jdbc/data_source_name.
  • When you create a connection factory, its default name is eis/j2c_connection_factory_name.
If you override these values by specifying your 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 you 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.