DBI/PERL Tutorial over the Web

Click to go to the PREVIOUS page. Click to go to the INDEX page. Click to go to the NEXT page.

SLIDE #2 DATABASE CONNECTION


In this second slide, we introduce the connection to our database.

1. THE DATABASE CONNECTION:

#Connect to the database
        $dbh=DBI->connect("DBI:mysql:$database:$db_server",$user,$password);
        $query = new CGI;
        print $query->header;
        print "\n<html>\n<body>";
        print "\n<h1>SQL Queries<h1>";

2. PROGRAM DESCRIPTION:

The first line creates a database object by calling the DBI->connect subroutine,
specifying as parameters the database interface, database name, database user 
and password.

The second line creates a CGI object
The third line displays the document header.
The fourth and fifth lines display the document title.


© Copyright 2002 International Customized Software Co.