faqts : Computers : Databases

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 2 people (50%) answered Yes
Recently 1 of 2 people (50%) answered Yes

Entry

Database: What are typical steps of getting information via an online database?

Jul 6th, 2008 13:30
Knud van Eeden, dman,


----------------------------------------------------------------------
--- Knud van Eeden --- 17 January 2005 - 00:34 am --------------------
Database: What are typical steps of getting information via an online 
database?
---
1. request the HTML page you want to fill in
  your computer
 +------------------------+
 |                        |
 | URL                    |
 |+-------------------+   |
 ||http://www.faqts.com\input.htm
 |+-------------------+   |
 |                        |
 |                        |
 |                        |
 |                        |
 |                        |---->---+
 |                        |        |
 |                        |        |
 |                        |        |
 |                        |
 |                        |        1
 |                        |
 |                        |        |
 |                        |        |
 +------------------------+        |
                                   |
                                   |
                                   |
                                   |
2. This request will be sent to the computer where this HTML page is
   stored                          |
                                   |
                                   |
other computer                     |
(or your own computer              |
 if you are testing)               |
 +------------------------+        |
 |                        |        |
 |                        |        |
 |+-----------------------|-<------+
 ||web server is listening|
 |+-----------------------|
 |                        |
 |                        |
 |                        |
 |                        |
 |                        |
 |  HTML file in some     |
 | +--------+ directory   |
 | |        | on its      |
 | +--------+ hard disk   |--------+
 |                        |        |
 |                        |        |
 |                        |
 |                        |        2
 +------------------------+
                                   |
                                   |
3. this computer via its web server sends you back
   the requested HTML file         |
                                   |
                                   |
  your computer, showing this      |
  HTML file in your browser        |
 +------------------------+        |
 |                        |        |
 |  +------------------+  |        |
 |  |                  |  |---<----+
 |  +------------------+  |
 |                        |
 |  +------------------+  |
 |  |                  |  |
 |  +------------------+  |
 |                        |
 |  +------------------+  |
 |  |                  |  |
 |  +------------------+  |
 |                        |
 |                        |
 |       +--------+       |
 |       | submit |       |
 |       +--------+       |
 +------------------------+
             |
             3
             |
4. After clicking on the submit button, your data is sent away to the
   receiving computer
             |
             |
             |
             V
other computer
(or your own computer
 if you are testing)
+-+--------------------+-+
| |web server listening| |
| |on some port        | |
| +--------------------+ |
|            |           |
|            |           |
|            |           |
|                        |
|            4           |
|                        |
|            |           |
|            V           |
|  Program which handles |
| +--------+ the input   |
| |        | data sent   |
| +--------+ by you, by  |
|  filling in the HTML   |
|  (e.g. Perl program)   |
|                        |
|                        |
+------------------------+
             |
             |
             5
             |
             V
             |
5. This program (e.g. written in Perl) connects to the database,
   performs an SQL query, gets the output from that back and sends a
   response back (usually by creating an HTML page via printing and
   concatenation of text)
             |
other computer
(or your own computer
 if you are testing)
+-+--------------------+-+
| |web server listening| |
| |on some port        | |
| +--------------------+ |
|            |           |
|            |           |
|            |           |
|                        |
|            6           |
|                        |
|            |           |
|            V           |
|  Database program      |
| +--------+ which       |
| |        | handles the |
| +--------+ SQL query   |
|            | (e.g.     |
|            |  MySql)   |
|            V           |
|            |           |
+------------------------+
             |
             |
             |
6. It sends its SQL query back to the calling program
             |
             7
             |
             |
             V
other computer
(or your own computer
 if you are testing)
+-+--------------------+-+
| |web server listening| |
| |on some port        | |
| +--------------------+ |
|            |           |
|            |           |
|            |           |
|                        |
|            8           |
|                        |
|            |           |
|            V           |
|  Program which handles |
| +--------+ the SQL     |
| |        | query data  |
| +--------+             |
|  (e.g. your Perl       |
|        program)        |
|            |           |
+------------------------+
             |
             V
             |
7. The program (e.g. your Perl program)
   generates an output
   (e.g. a HTML file containing
    a table resulting from your
    SQL query).
   And this is sent back to your
   computer
             |
             |
             |
             9
             |
             |
             V
  your computer, showing
  this generated HTML page,
  containing the
  resulting SQL
  query of your database,
  in your browser
 +-------------------------+
 |           |             |
 |           V             |
 |           |             |
 |  database table         |
 |  +---+---+--+--+--+--+  |
 |  | x | y | z| u| v| w|  |
 |  +---+---+--+--+--+--+  |
 |  | 1 | 3 | 5| 0| 1| 4|  |
 |  +---+---+--+--+--+--+  |
 |  | 2 | 4 |  | 9| 3| 9|  |
 |  +---+---+--+--+--+--+  |
 |  |   |   |  |  | 6|  |  |
 |  +---+---+--+--+--+--+  |
 |                         |
 |                         |
 |                         |
 |                         |
 |                         |
 +-------------------------+
---
---
Steps: Overview:
 1. -You type or click the URL of an HTML page
      e.g.
       http://www.faqts.com/databaseinput.htm,
 2. -This URL is used to contact the correct computer on the Internet
     on which this htm file is stored as a file in some directory
     on the harddisk of that computer.
     1. That is done so by looking up the IP address of that computer
        via the first part of the URL (by contacting a DNS server
        which will tell which IP address is corresponding to that
        http://www... address)
 3. -If there is a web server (like Apache, Microsoft IIS, ...) running
     on that computer, it will listen on the correct port (e.g. 80 or
     8080) and so possibly receive your request.
     1. -It will e.g. take the URL and remove the second part of it
         to determine in which directory the html file can be found
 4. -The web server will then send this html file back to your computer
     (it knows where to which IP address to send it to, because that
     information is send together with your request) where it is send
     further to your browser, where you so will see it appearing in
     your web browser (e.g. Microsoft Internet Explorer).
 5. -You do some (database) input actions on that HTML form
     1. e.g. possibly fill in some text fields with data
     2. then you push a 'submit' button which contains usually another
        URL of another program (usually written in Perl, Python, Java,
        JSP, PHP, ...) which will then further handle your input
        information.
        1. Usually when you press the 'submit' button by definition it
           sends the name and current value of all the elements in
           that current form to the URL as stated in the form 'action'
           field.
 6. -This new information is sent in a way similar as before to the
     computer's IP address corresponding to the latest URL in the form.
     1. Again there should be a web server running on that computer
     2. It will take off the directory information where the handling
        program should be found
        1. The first time it starts that program (e.g. the Perl
           interpreter, JSP engine, PHP engine, ...), loads the
           corresponding source code which you passed as a filename
           in your last URL
           1. That source code program (e.g. your Perl program) will
              further handle the information necessary.
              1. It opens e.g. a database (e.g. MySql)
              2. Runs some queries against that database
              3. Gets the output of that database back
              4. It will then generate, by printing and concatenation
                 of text, the HTML (or other e.g. text) information.
              5. This information is sent back to the requesting
                 browser, in this case to you, where you see the result
                 appearing in the webbrowser.
 7. -Thus if you are developing an online database, you should thus
     1. Create a HTML page where the user can input his database
        requests
        1. This HTML page should send its current data via a form
           which in the action field informs where the analyzing
           program can be found, and containing a submit button to
           send it away.
     2. Upload this HTML page to a directory of your computer, so that
        users can download it
     3. Create the program (e.g. in Perl) which will analyze this HTML
        input
     4. Upload this program (e.g. in Perl) to e.g. the cgi-bin
        directory of your computer (or in general to there were the
        analyzing executable or DLL knows where to find it)
     5. Make sure the database which will be queried is up and running
        and can be found (e.g. via IP address, port, username and
        password), e.g. by asking the provider or administrator where
        to find it.
     6. Make sure the web server (e.g. Apache) is running on the
        receiving computers where your pages are stored and or the
        database is running
---
---
Internet: see also:
---
Database: Internet: Database backed web site: Link: Overview: Can you 
give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/33424/fid/132
----------------------------------------------------------------------