I was browsing through the fix list for Version 6.1 of the Application Server and was interested to note that APAR PK32169 is removing the J2CA0294W warning messaging (unless you have debug trace turned on) in Fix Pack 5. This is the warning that you see when performing a direct JNDI lookup of a connection factory i.e. you go straight to the global namespace rather than using a resource-reference and the application’s local namespace (java:comp/env). This message has always been rather contentious as it asserted that direct JNDI lookups were being deprecated yet various parts of the product still continued to use them. There was even a technote describing how to suppress the warnings as, in some cases, they were causing significant performance degradation.
While it’s nice to see clarification that this functionality is not to be deprecated, it is worth pointing out what you are missing by not using resource-references. First, and most obviously, you are missing out on a layer of indirection, hardcoding in your application the name of an administratively defined resource. This leads to the possibility of naming collisions between different applications running in the same cell. However, as the warning message was always at pains to point out, without a resource-reference you are also getting the default settings for various properties.
One of these properties is the resource-authentication or res-auth which defaults to Application. This means that, in a secure environment, you have to either specify the connection credentials programmatically on creation or via a component managed authentication alias on the connection factory. Neither of these options is particularly good practice. The first means that the program has to hold the credentials somewhere and the second means that any server-side application with access to the JNDI namespace can create connections. Much better to use a resource-reference, specify a res-auth of Container, and then place the alias in the application bindings so it’s only available to the application that you intended.