Page 242 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 242

Unit 14: Application Development and Administration




                                                                                                Notes





          The CGI Script will be responsible for understanding what the Web Server is saying and will
          also be responsible for knowing how to talk to the Database. This type of CGI script is seriously
          multilingual.







          Of course, the CGI script can be written in any computer programming language and can use all
          sorts of inventive or proprietary methods to talk to the Database.











          14.2.3 Using Perl 5 and the DBI Module to Communicate with
                 Databases

          However, for purposes of demonstration, in this part we will show an example of writing a CGI
          script in Perl 5, using the DBI (Database Independent Interface) module supplied for free with
          the normal Perl 5 distribution.




              Task       What are the uses of XML? Discuss
          As an example, our DBI-aware Perl 5 CGI Script will be used to access an MS Access Database on
          a Windows 95 system using a local web server called Sambar.

          Of course, as we will see in just a bit, the fact that we use Perl 5 and the DBI module means, that
          the code we develop here will work on UNIX, NT or Macintosh without any modifications.
          It will also work “out of the box” for most commercial and public domain databases available
          for the web including Oracle, Sybase, Informix, Postgres, DB2, etc.
          Finally, you should know that you need not use Sambar as your Web Server. Any Web Server
          that can handle CGI will do. I am just using Sambar because it is free and it is what I happened
          to download. In retrospect, I would probably recommend Apache since  it is available on so
          many platforms.
          In short, the beauty of Perl and of the DBI module is that they are both designed to be highly
          cross platform and non-proprietary.











                                           LOVELY PROFESSIONAL UNIVERSITY                                   235
   237   238   239   240   241   242   243   244   245   246   247