I've worked on this today and here are the findings:
If the database that holds the client variables (I'll call this ClientDB)
goes down, the CFAPPLICATION tag with the
setting clientmanagement="yes" fails and throws an ODBC error. But, this
ODBC error is of UNKNOWN type so <CFCATCH Type="database"> doesn't catch it.
So for now I have wrapped CFTRY around CFAPPLICATION and am CFCATCHing "Any"
error. The only error I've ever seen related to CFAPPLICATION is the ODBC
error when the database has vanished.
So in the app_globals.cfm template I issue the CFAPPLICATION tag with the
setting clientmanagement="yes". If CFAPPLICATION throws an error, I re-issue
the CFAPPLICATION tag with the setting clientmanagement="no" inside the
CFCATCH. And I send a little message to myself to let me know something is
broken. (see code below)
<CFTRY>
<!--- If Client database is available, turn on client management --->
<CFAPPLICATION name="BP_Public" sessionmanagement="no"
clientmanagement="yes" setclientcookies="yes">
<CFCATCH TYPE="Any">
<!--- If Client database is not available, turn off client management
--->
<CFAPPLICATION name="BP_Public" sessionmanagement="no"
clientmanagement="no" setclientcookies="no">
<!--- Send e-mail if there is an error...allow the user to continue.
--->
<CFMAIL FROM="[EMAIL PROTECTED]" TO="[EMAIL PROTECTED]" SUBJECT="Web Site
Error - Database error while accessing ClientDB">
Type: #ReplaceNoCase(CFCATCH.Type,"<P>","#CHR(13)#
#CHR(13)#","ALL")#
Message: #ReplaceNoCase(CFCATCH.Message,"<P>","#CHR(13)#
#CHR(13)#","ALL")#
Detail: #ReplaceNoCase(CFCATCH.Detail,"<P>","#CHR(13)#
#CHR(13)#","ALL")#
</CFMAIL>
</CFCATCH>
</CFTRY>
The next issue is my use of URLTOKEN on every URL so I can manage the
session even if the user is not allowing cookies. What I found is if
clientmanagement is set to "yes" the URLTOKEN variable exists. But if the
clientmanagement is set to "no" the URLTOKEN variable does not exist. This
became the real challenge.
I decided that instead of making an IsDefined decision each time I use
URLTOKEN, I'd make that decision once and set a variable equal to URLTOKEN
if it exists and set the variable to empty if URLTOKEN didn't exist. Then I
ran through all of my code and replaced the URLTOKEN variable name with my
new variable name. Now if the URLTOKEN variable exists, it is appended. If
it doesn't exist, it is not appended. For CFLOCATION tags that were set to
ADDTOKEN="Yes", I created a variable to hold the "Yes" or "No" value and use
that variable in this manner: <CFLOCATION URL="http://www.blah.com"
ADDTOKEN="#Variables.AddToken#">
Here's some code showing how I've defined the variables:
<!--- Set the URLTOKEN if the value exists, otherwise append nothing to the
URL --->
<CFIF IsDefined("URLTOKEN")>
<CFSET Variables.Token = "&#URLTOKEN#">
<CFSET Variables.AddToken = "Yes"> <!--- Used for CFLOCATION tags
throughout the application --->
<CFELSE>
<CFSET Variables.Token = "">
<CFSET Variables.AddToken = "No">
</CFIF>
I also use my variable AddToken to make some decisions within the templates
to display or hide parts that are dependent on the database.
I've been testing for the last 3 hours and it works very well. When the
database is not available the site runs as normal except no URLTOKEN info is
appended and certain parts of the site that depend on the database are
gracefully hidden. As soon as the database is available, the URLTOKEN
information is appended and the Web site rolls on.
Thanks for all of your input!
Scott
-----Original Message-----
From: Scott Knaub [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 28, 2000 10:33 AM
To: '[EMAIL PROTECTED]'
Subject: Has anyone CFTRY'd this?
I have a Fusebox site on two load-balanced Web servers that are using Client
variables stored in a central database to manage session information. The
database server is Sybase Adaptive Server Anywhere 6.0 and at this time
there is no redundancy on this database server. (I know...this is bad...we
are working on it.)
Currently when the database server goes down, the CFAPPLICATION tag with the
setting clientmanagement="yes" fails and that stops the entire site.
My idea is to CFTRY the CFAPPLICATION tag in app_globals.cfm and CFCATCH any
ODBC error. If an ODBC error is caught, I'd like to re-issue the
CFAPPLICATION tag with the setting clientmanagement="yes" changed to
clientmanagement="no". I'd also like to set an application variable called
ODBC_Available to False so I can let the user know that the database
functions are not available on the pages where the database is required.
This way, if the database server goes down, the Web site allows the user to
view pages that do not require the database.
Has anyone else built a work around for the CFAPPLICATION tag when dealing
with a temperamental database? For next year we are budgeting a redundant
database server configuration, so that should help in the long run.
Thanks,
Scott
----------------------------------------------------------------------------
--
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.