I recently ran into an issue with CF MX7 scheduled tasks (Win2K3, IIS6, CFMX 
7).  I've got a script that grabs data from a remote database every 5 hours and 
puts it into our databases at work so people using the website can search for 
real estate properties.

First, this script runs from a directory below my webroot, where an 
Application.cfc file exists.  In there, there's an onError handler that is 
supposed to send me an email every time there's an error on the site -- pretty 
standard practice from what I hear.  However, I forgot to add the remote 
datasource to CF administrator, so I should have been getting errors emailed to 
me when that script ran every 5 hours.  I never got the emails from that 
script, but I did from other errors on the site.  To remedy that, I put in a 
try/catch.  

The first email I got from the try/catch told me that "remoteDSN is undefined 
in application".  When I pointed my browser directly to the CF page, it ran 
with no problems.  5 hours later, I got another email with the same undefined 
in application error.  Again, going to the page in the browser worked.  I 
couldn't think of why that wasn't working, but I took added a <cfset 
application.remoteDSN = 'thedatabase'> at the top of the page and have yet to 
get an error email.  I also know it's now working as I record the times the 
data is populated in our database: every 5 hours, like clockwork.

My question is simply, "When CF runs a scheduled task that was created in the 
administrator, does it ignore the Application.cfc file in the webroot?"  If 
there's a setting somewhere I missed that can toggle that, I'd also be 
interested in that.  And if anyone else has had this issue (or not had this 
issue and successfully used application variables in a CF scheduled task).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2757
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to