jquery or javascript reading database

Hello. I have code in jquery which reads a remote database. I am worried about what could happen if that database for some reason goes down. I was wondering if there is a way to switch to another database if the read from the first one fails? Is there some way to know if the read fails?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sudhindra A NCommented:
As far as I know, jQuery or javascript cannot access database. Server side programming is necessary to connect to database (like asp, jsp, php or coldfusion etc.).

jQuery may trigger an ajax call (or a browser request) to the server which inturn talks to database and returns data.

You can switch to another database if the read form one database fails.
a. check connection for first database, if it fails connect to second database
b. If first database connects and read returns 0 records from database,  connect to 2nd database and read.
you can also use try catch blocks in your server side coding to achieve the same.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
onyourmarkAuthor Commented:
Thanks. I meant a jquery ajax call.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.