Page 258 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 258
Unit 14: Application Development and Administration
use. Although, Microsoft Access does not support websites with a lot of traffic, it is quite suitable Notes
for our example. A web database makes it very convenient to build a website.
Let us show the process of creating a web database. We would need to follow the following steps
to create a student database and to make it accessible as a web database.
1. The first step is to create a database using Ms-Access with the following configuration:
Student-id Text (10) Primary Key
Name Text (25)
Phone Text (12)
Now, you would need to enter some meaningful data into the database and save it with
the name students.mdb.
2. Put your database online by using ftp to transfer students.mdb to the web server on which
you are allowed access. Do not put the file in the same directory in which your web site
files are stored, otherwise, the entire databases may be downloaded by an unauthorised
person. In a commercial set up it may be better to keep the data on the Database server.
This database then can be connected through a Data Source Name (DSN) to the website. Let
us now build the required interface from ASP to the Database. A simple but old method
may be with connecting ASP using ActiveX Data Object (ADO) library. This library provides
ASP with the necessary functionality for interacting with the database server.
3. The first and most basic thing we need to do is to retrieve the contents of the database for
display. You can retrieve database records using ADO Recordset, one of the objects of
ADO.
Dim recordsettest
Set recordsettest = Server.CreateObject(“ADODB.Recordset”)
The commands given above create a variable (recordsettest) to store new Recordset object
using the Server object’s CreateObject method.
4. Now fill this Recordset with records from the database with its Open method. Open takes
two parameters:
(a) The table name that contains the records to be fetched and
(b) The connection string for the database.
Now, the name of the table is straight forward, as we would obviously, create a table with a
name. However, the connection string is slightly more complex. Since the ADO library is capable
of connecting to many database servers and other data sources, the string must tell Recordset not
only where to find the database (the path and file name) but also how to read the database, by
giving the name of its database provider.
A database provider is a software that has a very important role. It allows ADO to communicate
with the given type of database in a standard way. ADO the provider for MS-Access, SQL Server,
Oracle, ODBC database servers etc. Assuming that we are using the provider Jet.OLEDB to
connect to an Access database, the connection string would be:
Provider = Microsoft.Jet.OLEDB.version; Data Source = ~\student\student.mdb
A connection string for MS SQL may be like:
Provider = SQLOLEDB; Data Source = servername; Initial Catalog = database name;
User Id = username; Password = password.
LOVELY PROFESSIONAL UNIVERSITY 251