Quantcast
Viewing all articles
Browse latest Browse all 21760

Re: application.cfc saving old datasource?

The data source needs to be defined outside the onApplicationStart() method, in an area known as the "pseudo-constructor".  Since application.cfc is called on every request, it reads the area outside the functions, and executes that code.  If you placed:

 

<cfset this.datasource = 'default_datasource_name' />

 

Then, that value is set on each page request.  If, instead, you define your variables inside the onApplicationStart() function, it is only executed once (when the application starts), and on subsequent page requests, the onApplicationStart() method is not called, so making a change there to the new value will not "take".

 

You can manually call the onApplicationStart() method, which WILL re-execute that code, but it will not start a new application.


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>