View Single Post
  #9 (permalink)  
Old Jan 15th, 2008, 09:56
spinal007's Avatar
spinal007 spinal007 is offline
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: ASP - XML (Retrieve Database Value Using XML)

ok monie, I'll explain - and for that I will assume you understand these terms:
- client: the machine viewing the webpage, the visitor's computer
- server: the machine where your website is hosted
- database server: the machine where the database is hosted
(websites and databases are not usually hosted together)

Let's consider an address book lookup in Javascript, as I mentioned above.
you need:
a) Data - a "list" of names and email addresses
b) Functionality - the ability to search

Let's assume the 'data' is on your database server and the client will access it via your website.
1. Client requests page from web-server
2. Web-server runs script connects to database and retrieves data
3. Web-server processes data and sends a response
4. The response is processed by the client's browser (they see it some how)

In the most common scenario, the web-server will ask for the database to give it some data. The database server will take care of searching. The web-server will only deal with 'presenting the data'.

When the user searches again, you will have to go through all those stages again. This is a classic web-application - no caching involved - simple, raw, get the job done. But this isn't good enough if you care about performance or if you are building a large-scale application.

So that's where XML comes in (there are other formats but let's just assume XML is the way to do it)

If you save the data from the database on the web-server, you allow yourself to skip step 2. You don't have to call the database server again. But then, there will be more processing for the web-server to do. It will have to get the file from somewhere and perform any search functionality required.

If you use the web-server to send ALL the data to the client - let's say, in XML format - without any filters (not searched) then you can skip step 1, 2 and 3 from then on.
What happens now is that you leave the processing (searching through the data) to the client AND you cut off all the traffic between the client, your web server AND your database server.

Go to run - hope you understand it now!

(perhaps I could turn this into an article...)
Reply With Quote