Solved

jquery or javascript reading database

Posted on 2012-03-20
2
259 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Open dialog with server side controls in it 3 46
ASP.NET - Why is accordion not working? 3 44
pass foreach data in php into jquery ajax 10 44
ModalPopup  question 22 36
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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…

680 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