Connection factory JNDI name tips


Naming services provide name-to-object mappings. Directory services provide information on objects and the search tools required to locate those objects.

JNDI provides a common interface that is used to access the various naming and directory services. After you have set this value, saved it, and cycled the server, be able to see this string when you run

For WAS specifically, when you create a data source the default JNDI name is set to...


When you create a connection factory, the default name is...


You can override these values by specifying your own. For example...


If you click the checkbox...

Use this data source for container managed persistence
...when you create the data source, another reference is created with the name of...


For example, if a data source has a JNDI name of jdbc/myDatasource, the CMP JNDI name is...


This name is used internally by CMP and is provided simply for informational purposes.

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. Generally an "indirect" name with the java:comp/env prefix should be used. This 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.

While the use of a direct JNDI name is supported, such use results in default values of these resource-ref data. You will see an informational message logged such as this

J2CA0122I: Resource reference abc/myCF could not be located, 
so default values of the following are used: [Resource-ref settings]
   res-auth:                 1 (APPLICATION)
   res-isolation-level:      0 (TRANSACTION_NONE)
   res-sharing-scope:        true (SHAREABLE)
   res-resolution-control:   999 (undefined)