What I did in the past for such situation (which can easily addressed by SQL cluster by the way for scenario 1):
configure the DB to target a DNS alias, that way, it doesn’t matter which server you have in the backend, you want to use another server, you update the DNS record, and voilà.
And to go a bit deeper, I used two scripts:
1. Do a backup of server A and push it to server B and restore on B to always have B up-to.date (well, with a 5 to 10 minute gap, not that much) who monitors server A availability and update the DNS record to target server B in case of server A crash.
2. Monitor server A availability and update the DNS record to target server B if A has crashed