Basics of Web database by SanjuDudeja


More Info
									         Basics of Web database

• With the advent of Web database technology,
  Web pages are no longer static, but dynamic
  with connection to a back-end database.
• Web sites are now able to display updated
  information on-the-fly and support user
• One can use the same page to display
  information of thousands of products in a
      Three tiers of Web database

• To build a Web database, usually we need to
  use a three-tier model:
   – Web server
   – Web application server (middleware), and
   – Database
    How a user interacts with a Web
1. From a Web browser, a user submits a
   request to the Web server.
2. The Web server passes it onto the
3. The middleware writes the request in SQL
   queries and sends it to a back-end
4. The data retrieved are handed back to the
    How a user interacts with a Web
5. The middleware generates a Web page for
    the data
6. The Web server sends the Web page to the
7. The browser displays the Web page to the
        Web database connectivity

• Web-database connectivity takes several
  different forms:
   – CGI scripting A custom application is
     developed using a traditional programming
     language (such as C++, Python, Perl, or
     Java) accessed through the Common
     Gateway Interface (CGI).
   – Application server Such as ColdFusion or
     ASP, which works with the Web server that
     can communicate with databases through
 ASP – Middleware for Windows platform

• ASP stands for Active Server Pages

• ASP is a programming environment that gives
  the ability to generate dynamic html pages
  with the help of server side scripting.

• VBScript is the default scripting language for
 ASP – Middleware for Windows platform

• An ASP page is almost the same as a HTM
  or HTML page... the only difference is that an
  ASP page has the '.asp' extension

• Active Server Page can include both client
  side and server side scripts.

• In an ASP page VBScript is usually used as
  the server side and Java Script as the client
  side scripting language
 Special software needed to write ASP?

• You don't need any special software to write
  an ASP page.

• An ASP page can be written with any HTML
  editor... even in Windows Notepad.

• If you are looking for some special software to
  write an ASP page, Microsoft Visual InterDev
  is the best tool for you.
 Special software needed to write ASP?

• InterDev helps you to easily develop ASP
  applications because it simplifies the process
  of developing and debugging ASP

• ASP is browser independent because all the
  scripting code runs on the server and the
  browser only gets a normal HTML page as a
  result of server side scripting.
             ASP compatibility

• ASP is an engine/program built into Internet
  Information Server (IIS) / Personal Web
  Server (PWS)
• PWS is a smaller - but fully functional -
  version of IIS
• To run IIS you must have Windows NT 4.0 or
• To run PWS you must have Windows 95 or
           What is an ASP file?

• An ASP file is just the same as an HTML file
• An ASP file can contain text, HTML, XML,
  and scripts
• Scripts in an ASP file are executed on the
• An ASP file has the file extension *.asp
             How does it work?

• When a browser requests an HTML file, the
  server returns the file
• When a browser requests an ASP file, IIS/
  PWS passes the request to the ASP engine
• The ASP engine reads the ASP file, line by
  line, and executes the scripts in the file
• Finally, the ASP file is returned to the browser
  as plain HTML
       What can be done with ASP

• Dynamically edit, change or add any content
  of a Web page
• Respond to user queries or data submitted
  from HTML forms
• Access any data or databases and return the
  results to a browser
       What can be done with ASP

• The advantages of using ASP instead of CGI
  and Perl, are those of simplicity and speed
• Provides security since your ASP code can
  not be viewed from the browser
• Since ASP files are returned as plain HTML,
  they can be viewed in any browser
            A sample ASP script

<HEAD> <TITLE>Hello World</TITLE>
' This will print to the browser the
' words Hello, ASP World.
response.write "Hello, ASP World!"
        ASP and database server

• To interact with a database, you usually have
  to add code that talks to a particular database
  using a proprietary language.
• If you want your program to talk to an Access,
  FoxPro and Oracle databases you have to
  code your program with three different
  database languages.
        ASP and database server

• When programming to interact with ODBC
  you only need to talk the ODBC language.
• The ODBC Manager will figure out how to
  contend with the type of database you are
• All that you need to do is have installed an
  ODBC driver that is specific to the type of
  database you will be using.

• ODBC stands for Open Database Connection
  (or Connectivity).
• ODBC makes it easy to create ASP scripts
  that will connect to a database.
• Normally, each ODBC will have a DSN (Data
  Source Name).
• DSN contains all the information about the
            Setting up the DSN

• Setting up the DSN is a simple process.
• Simply double-click the ODBC in the Control
• Choose the System DSN tab, and click Add.
  Choose the type of database you'll be
  working with - the sample database is MS
  Access - then click finish.
• You'll then need to type in the database name
  in the Data Source Name box, and click
             Setting up the DSN

• Next you'll navigate to the drive and directory
  where the database is located,
• Click on the file name and click OK on that
  window and the one behind it.
• Now you can refer to the database by name
  in your scripts and the system will know which
  ODBC driver to use and where the database
  is located.
             Online ASP Tutorials


To top