For configuring JNDI data sources, it should firstly be supported by the application server.
Tomcat server, which is built-into ColdFusion server, has the support for this by default.
While there is a blog Here on this how to configure, I want to explain few mistakes that are tend to be done while configuring.
One common mistake generally done is:-
When the data source is configured from the ColdFusion administrator by providing irrelevant username/password.
You may tend to provide Database's username/password. This is NOT Database's username/password.
It is the application server's username and password on which data source is configured.
It should be left blank when the credentials are not required by the server.
Prepending java:comp/env/ is required for the actual JNDI name that is registered in xml while registering the name in administrator.
It is not mandatory that you register the JNDI data source in ColdFusion administrator.
As long as the app server supports JNDI, you can invoke the data
source that is configured in the application server in cfm source code directly
either in case of standalone installation or EAR/WAR deployment.
But for consistency and preferred names that can used in ColdFusion should be registered in ColdFusion.
This is applicable to both ColdFusion 10 and ColdFusion 11.