Ask a Question related to Coldfusion Database Access, Design and Development.
-
ccosart #1
<cftry> catches error but page doesn't load
Hi,
I have an issue which has me stumped. We display some dynamic content
on our index.cfm page using SQL Server and Cold Fusion. We've had some
issues with services restarting after windows updates, etc. so I added
some error trapping to display default content. If I change the table
name or datasource name to test the error trapping, it works fine, I
get an email and the hardcoded content is displayed.
However, today we had a problem with SQL Server not restarting after an
update (actually it did but CF couldn't find it, but that's not my
question). <CFTRY> caught the error and sent the email:
Message: Error Executing Database Query.
Detail: SQL Server
does not exist or access denied.
And sent me an email, but the browser was displaying 'page not found'
error and not the CF version.
I'm completely baffled.
Here's the code in question, it's in the header:
<CFTRY>
<!--Get Factoid-->
<cfquery datasource="data_ole" name="GetDYK">
Select DYK from tb1 where dykID=#dykRandom#
</cfquery>
<cfset fDYKtext=#GetDYK.DYK#>
<!--All errors-->
<CFCATCH TYPE ="Any">
<cfset fDYKtext="Despite the challenges they face, ninety-five
percent of 2004 survey respondents would recommend their
college
to a friend or family member, and 86% rate their overall
educational
experience at the college as good or excellent.">
<!--This mail part needs to be commented out to display in the design
window on dreamweaver. Still works though. Don't know why....
<cfmail to="ccos...@bbb.org" from="i...@ccsse.org" subject="!!!!Error
on Index Page!!! EXCEPTION: #CFCATCH.type#" server="mail.utexas.edu">
Message: #CFCATCH.message#
Detail: #CFCATCH.detail#
</cfmail>!-->
</cfcatch>
</cftry>
<CFTRY>
<!--Get IQ Question-->
<cfquery datasource="ccssedata_ole" name="GetIQ">
Select question, A, B, C, D, E from tb2 where IQID=#IQRandom#
</cfquery>
<cfset fIQquestion=#GetIQ.question#>
<cfset fIQA=#GetIQ.A#>
<cfset fIQB=#GetIQ.B#>
<cfset fIQC=#GetIQ.C#>
<cfset fIQD=#GetIQ.D#>
<cfset fIQE=#GetIQ.E#>
<!--All other errors-->
<CFCATCH TYPE ="Any">
<!--Use a hard coded factoid!-->
<cfset fIQquestion="What percentage of U.S. undergraduates in public
higher education attend community colleges?">
<cfset fIQA="17%">
<cfset fIQB="26%">
<cfset fIQC="35%">
<cfset fIQD="47%">
<cfset fIQE="">
<!--
<cfmail to="ccos...@bbb.org" from="i...@ccsse.org" subject="!!!!Error
on Index Page!!! EXCEPTION: #CFCATCH.type#" server="mail.utexas.edu">
Message: #CFCATCH.message#
Detail: #CFCATCH.detail#
</cfmail>!-->
</cfcatch>
</cftry>
Any thought or suggestions appreciated. Do I need to do a separate
check for connectivity? I can't figure out why this error doesn't get
treated the same as the other ones...
Thanks,
Chris
ccosart Guest
-
problems with cftry tag
Ok so I have set up a cftry tag before a set of if statements once it gets to one set of if statements I then use a cfthrow tag that comes to a... -
<CFTRY> <CFCATCH>
I would like to know whether there's a way to obtain the SQL statement via cfcatch's like I see when I use cferror or default to the error message. ... -
#22519 [Fbk->NoF]: Apache catches SEGV
ID: 22519 Updated by: sniper@php.net Reported By: thomas dot mieslinger at gls-germany dot com -Status: ... -
#22519 [Opn->Fbk]: Apache catches SEGV
ID: 22519 Updated by: sniper@php.net Reported By: thomas dot mieslinger at gls-germany dot com -Status: Open... -
Same pattern, ereg_replace catches it, ereg doesn't
Hi all, My guess is I miss something really dumb, but here is my problem. I want to use ereg to find some pattern, but it doesn't seems to work.... -
drew222 #2
Re: <cftry> catches error but page doesn't load
Chris,
You might want to put a small query in the Application.cfm that traps any
database errors. Since the Application.cfm file is processed before the
index.cfm page, you should solve the problem about DB connectivity.
I hope that helps,
drew222 Guest



Reply With Quote

