Solved

jquery or javascript reading database

Posted on 2012-03-20
2
254 Views
Last Modified: 2012-03-20
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?
Thanks.
0
Comment
Question by:onyourmark
2 Comments
 
LVL 13

Accepted Solution

by:
ansudhindra earned 500 total points
ID: 37745736
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.
0
 

Author Closing Comment

by:onyourmark
ID: 37745769
Thanks. I meant a jquery ajax call.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now