> We have a SQL Server 7 implementation with three CF servers using it as a
> database server.
>
> The problem is that it's falling over regularly (and the technical guys
> can't figure it out).
>
> That's not the problem though.  We are now setting up a second
> SQL Server 7
> for use as a failover. It will replicate all of the data.  My
> boss wants to
> know if it is possible for CF to use one or other of the database servers
> depending on what is up!
>
> So the idea is:
>
> For each query - check which server is up and choose one to use
> (assuming we
> can replicate all data)
>
> This doesn't make very much sense to me (it's not my idea, I just
> got asked
> to ask the list) as I would do it differently anyway!
>
> So situation (again)
>
> 2 SQL servers
>       Q: can we replicate the data so they effectively are the same?
> 2 CF Server
>       Q: without having to change EVERY <cfquery> can we make
> something that will
> use one or other to retrieve data depending on which one is up.
>
> Is this possible?

Warning, this is a fudge, and I wouldn't recommend doing this on a heavily
hit site...

Here's a software way to get CF to talk to whichever one you want (without
any special coding or software)

Put 2 datasources on the CF servers, one pointing to each SQL machine...
At the top of application.cfm (or the primary template) put the following
code

<cfset application.DSN="DSN1">
<cfset CanUseDSN1="No">
<cftry>
        <cfquery name="testDSN" datasource="#application.DSN#">
                select top 1 ID (nolock)
                from table
        </cfquery>
        <cfset CanUseDSN1="Yes">
        <cfcatch>
        </cfcatch>
</cftry>
<cfif not CanUseDSN1>
        <cfset application.DSN="DSN2">
</cfif>

I've left off the Locking code to keep it short, but you get the drift -
this will work, but not particularly brilliantly

It's cheap (free), but puts a tiny bit of load onto the front end of the
templates


Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to