Kevin,
You could just decide when you want to Change the Global variable for the connectionstring before you open the table(s).
And make sure that you control how persistent that value is. (where the initial values are pulled/stored)
i do something like this on specific pages to dynamically flip my connection to use different databases/servers simultaneously.
i don't use this for Failover but i don't see why it couldn't work.
(could be application specific things to consider if you cache or keep things open outside of nettalk pages like in Netwebserver)
The alternative could be to simply note the new preferred server and Trigger a restart of your webserver. So it will start using the Backup...
I think i like this better as everyone gets an error (you could even do it gracefully for active users if required) and it forces everyone to login,
where you can notify about whats up... and it works regardless of file drivers- you didn't say but i assume MS SQL.
They lose current transactions, but that's likely anyway unless you get quite clever or its really simple.
the challenge is if you want it automatic is deciding when to failover.
By the book with M$, you have clusters, and a witness, with heartbeats to etc
in the end it is an arbitrary assumption you will make, probably based on some timeout.
When Anything on that connection fails is when you might suspect.
Perhaps I would check when files open before some specific critical activities - like login, but not every call, i think.
But i guess it depends on your requirements.
Regardless, once you detect failure(or suspect), you need more aggressive testing analysis.
You would want to "fail-over to Backup" mode only when you are confident its correct to do so.
Like test to make sure the backup is available first!
do some additional test to make sure your primary is truly unresponsive
or that it wasn't just a momentary hiccup ...
poul