Here’s a guide to show you how to configure JNDI datasource in ColdFusion 10.

1. Get the JDBC Driver

The JDBC Driver needs to be placed in ColdFusion10/cfusion/runtime/lib folder.

2. context.xml configuration

Add a resource block before the closing tag (</Context>) in the context.xml present at ColdFusion10/cfusion/runtime/conf , which defines database connection detail :

<Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource"

          maxActive="50" maxIdle="30" maxWait="10000"

          username="username" password="password"



For more information on the attributes please refer to setting isolation level use the defaultTransactionIsolation attribute.

3. web.xml configuration

In the web.xml present at ColdFusion10/cfusion/wwwroot/WEB-INF , add the following just before the closing tag (</web-app>):


<description>MySQL Datasource example</description>






4. Add ColdFusion DataSource through Administrator

After saving the configuration files restart the ColdFusion server.Log in to ColdFusion Administrator and navigate to Data & Services > Data Sources and add a new Data Source by selecting J2EE Data Source(JNDI) in the driver drop down.For more details on this refer .

Data Source registration page


Hope you found this useful.Write in to us if you have any issues with the Tomcat specific configuration.



3 Comments to “Connecting to JNDI data sources in ColdFusion 10”

  1. Michael
    We are having problems with loading an EJBHome.class in relation to possibly JNDI with CF code that ran find on CF8 and now fails on CF10 with the EJBHome class not found even if I have placed j2ee.jar wich contains the EJBHome class in the classpath of CF???? Perhaps the change for JNDI under tomcat is the culprit??? What are the details in how and why JNDI has changed from going to tomcat to jrun for CF10?
  2. grails jndi user
    It's nice that Tomcat has support for JNDI, specially now for CF10
  3. vaish
    Can these JNDI datasources be used from a Spring Roo Java application ? My app works fine in tomcat 8. but now i have to modify it to use CF11 app server provided datasources. I tried with coldfusion.server package provided DataSourceService class, but could not plug the datasource to Spring entityManagerFactory.
    Stumbled upon your blog of creating JNDI datasource, can these be accessed from app with project setting as above?

Leave a Comment

Leave this field empty: