Datasheet

Displaying Data on the Web
15
The diagram below lays out the three steps mentioned above, and places them in context with the code
that you'll need to write, and the data store itself.
Database
returns
connection
Database
retrieves data
Database/Data Access
Code
Request made for
connection, specifying
permissions, etc.
Specify the information
required
Data converted to required
format
UI receives data
Data is displayed
UI requests data through
method call
Business logicUser interface
Connect to
data-source
Read/convert data
Display data
Reading it from left to right, this diagram shows that there are three clearly separated aspects to the
system: the application that requests the data, the code that communicates with the database and
operates on the data, and the database itself. The details of this three-part structure and how it can be
used to best effect are given later on in this chapter; for now, we'll continue on our top-to-bottom route.
Connecting to the data source. Before we can issue any commands to the database or retrieve any
data from it, we must create a connection to it. This provides a conduit through which we can
send and retrieve data. To establish a connection, we need to specify such things as the type of
database we are opening, where it is located, and any necessary security permissions. Once
this has been done, and the connection has been opened, we can start to send instructions to
the database.