i have build my application.cfc file and i am using the following to declare my dns under application start session :
now how can i call that #application.dns# as my data source in other cfm pages ?
Exactly as you have it. You can put it in a
<cfquery> as such:
Be aware though that the
<cfquery name="myQuery" datasource="#application.dsn#">
onApplicationStart method only runs on the first request to an application. This means that if you have added that
<cfset> after running some pages in your application,
#application.dsn# will not be set until you do one of the following:
a) Restart the ColdFusion service on your computer.
b) Let the application time out (which you probably don't want to wait for!), or
c) If you have ColdFusion 9, you can run the
applicationStop() function in a .cfm page, and the next request to a page will cause
onApplicationStart() to execute, and set your variable.
do you think this is something needs to be called on RequestStart..
i am using only 2 dsn's in whole applications
No, this is something that belongs in
application.dsn should only have to execute once when the ColdFusion application starts, and not on every request to a .cfm page.
Originally Posted by korssane
I also think so.
Watch The Twilight Saga: Breaking Dawn Online Free