Whatever message this page gives is out now! Go check it out!
<cffunction name="onApplicationStart" returnType="boolean"> ... <cfreturn Boolean> </cffunction> |
<cffunction name="onApplicationStart"> <cftry> <!--- Test whether the DB is accessible by selecting some data. ---> <cfquery name="testDB" dataSource="cfdocexamples" maxrows="2"> SELECT Emp_ID FROM employee </cfquery> <!--- If you get a database error, report an error to the user, log the error information, and do not start the application. ---> <cfcatch type="database"> <cfoutput> This application encountered an error<br> Please contact support. </cfoutput> <cflog file="#This.Name#" type="error" text="cfdocexamples DB not available. message: #cfcatch.message# Detail: #cfcatch.detail# Native Error: #cfcatch.NativeErrorCode#" > <cfreturn False> </cfcatch> </cftry> <cflog file="#This.Name#" type="Information" text="Application Started"> <!--- You do not have to lock code in the onApplicationStart method that sets Application scope variables. ---> <cfscript> Application.availableResources=0; Application.counter1=1; </cfscript> <cfreturn True> </cffunction> |