Application-wide datasource in Railo

Another one of those features that I knew was is in CF 9 but didn't know was in Railo and thats Application wide datasource name.

What this means is that in your Application.cfc (NOT .cfm!) you can set a per-application datasoure which lets you ommit the "datasource" attribute in your <cfquery> tags.

Your Application.cfc

// Set the application name this.name = "myApp" & hash(getCurrentTemplatePath()) // Set the datasource this.datasource = "myDSN";

Your test.cfm page

SELECT * FROM yourTable
comments powered by Disqus