Download ebooks file Database Design and Implementation 2nd Edition -- all chapters
Download ebooks file Database Design and Implementation 2nd Edition -- all chapters
com
https://textbookfull.com/product/database-design-
and-implementation-2nd-edition/
https://textbookfull.com/product/database-systems-design-
implementation-and-management-13th-edition-carlos-coronel/
textbookfull.com
https://textbookfull.com/product/database-systems-design-
implementation-management-12th-edition-carlos-coronel/
textbookfull.com
https://textbookfull.com/product/pro-sql-server-relational-database-
design-and-implementation-5th-edition-louis-davidson/
textbookfull.com
https://textbookfull.com/product/commonwealth-history-in-the-twenty-
first-century-saul-dubow/
textbookfull.com
Semi-Presidential Policy-Making in Europe: Executive
Coordination and Political Leadership Tapio Raunio
https://textbookfull.com/product/semi-presidential-policy-making-in-
europe-executive-coordination-and-political-leadership-tapio-raunio/
textbookfull.com
https://textbookfull.com/product/topological-aspects-of-condensed-
matter-physics-1st-edition-claudio-chamon/
textbookfull.com
https://textbookfull.com/product/german-political-thought-and-the-
discourse-of-platonism-finding-the-way-out-of-the-cave-paul-bishop/
textbookfull.com
https://textbookfull.com/product/the-rough-guide-to-sweden-7th-
edition-rough-guides/
textbookfull.com
https://textbookfull.com/product/where-is-area-51-paula-k-manzanero/
textbookfull.com
Functional Analysis of the Human Genome First Edition
Cooper
https://textbookfull.com/product/functional-analysis-of-the-human-
genome-first-edition-cooper/
textbookfull.com
Data-Centric Systems and Applications
Edward Sciore
Database
Design and
Implementation
Second Edition
Data-Centric Systems and Applications
Series editors
Michael J. Carey
Stefano Ceri
The first edition of this book was published by John Wiley & Sons, Inc.
This Springer imprint is published by the registered company Springer Nature Switzerland AG.
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
Preface
v
vi Preface
This text examines database systems from the point of view of the software
developer. This perspective allows us to investigate why database systems are the
way they are. It is, of course, important to be able to write queries, but it is equally
important to know how they are processed. We don’t want to just use JDBC, we
want to know why the API contains the classes and methods that it does. We need a
sense of how hard is it to write a disk cache or logging facility. And what exactly is a
database driver, anyway?
The first two chapters provide a quick overview of database systems and their use.
Chapter 1 discusses the purpose and features of a database system and introduces
you to the Derby and SimpleDB systems. Chapter 2 explains how to write a database
application using Java. It presents the basics of JDBC, which is the fundamental API
for Java programs that interact with a database.
Chapters 3–11 examine the internals of a typical database engine. Each of its
chapters covers a different database component, starting with the lowest level of
abstraction (the disk and file manager) and ending with the highest (the JDBC client
interface). The chapter for each component explains the issues and considers possi-
ble design decisions. As a result, you can see exactly what services each component
provides and how it interacts with the other components in the system. By the end of
this part, you will have witnessed the gradual development of a simple but
completely functional system.
The remaining four chapters focus on efficient query processing. They examine
the sophisticated techniques and algorithms that can replace the simple design
choices described earlier. Topics include indexing, sorting, intelligent buffer
usage, and query optimization.
Text Prerequisites
End-of-Chapter Readings
End-of-Chapter Exercises
The end of each chapter contains numerous exercises. Some exercises are of the
pencil-and-paper variety, designed to reinforce concepts taught in the chapter. Other
exercises suggest interesting modifications to SimpleDB, and many of them make
excellent programming projects. I have written solutions to most of the exercises. If
you are the instructor of a course using this textbook and would like a copy of the
solution manual, please email me at [email protected].
Contents
1 Database Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Why a Database System? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 The Derby Database System . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Database Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 The SimpleDB Database System . . . . . . . . . . . . . . . . . . . . . . 10
1.5 The SimpleDB Version of SQL . . . . . . . . . . . . . . . . . . . . . . . 11
1.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.7 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1 Basic JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Advanced JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Computing in Java vs. SQL . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.4 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.5 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3 Disk and File Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.1 Persistent Data Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 The Block-Level Interface to the Disk . . . . . . . . . . . . . . . . . . 60
3.3 The File-Level Interface to the Disk . . . . . . . . . . . . . . . . . . . . 61
3.4 The Database System and the OS . . . . . . . . . . . . . . . . . . . . . . 65
3.5 The SimpleDB File Manager . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.7 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
3.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4 Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.1 Two Principles of Database Memory Management . . . . . . . . . 79
4.2 Managing Log Information . . . . . . . . . . . . . . . . . . . . . . . . . . 81
ix
x Contents
9 Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
9.1 Syntax Versus Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
9.2 Lexical Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
9.3 The SimpleDB Lexical Analyzer . . . . . . . . . . . . . . . . . . . . . . 241
9.4 Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
9.5 Recursive-Descent Parsers . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
9.6 Adding Actions to the Parser . . . . . . . . . . . . . . . . . . . . . . . . . 250
9.7 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
9.8 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
9.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
10 Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
10.1 Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
10.2 The Cost of Evaluating a Query Tree . . . . . . . . . . . . . . . . . . . 268
10.3 Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
10.4 Query Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
10.5 Update Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
10.6 The SimpleDB Planner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
10.7 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
10.8 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
10.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
11 JDBC Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
11.1 The SimpleDB API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
11.2 Embedded JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
11.3 Remote Method Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . 300
11.4 Implementing the Remote Interfaces . . . . . . . . . . . . . . . . . . . . 305
11.5 Implementing the JDBC Interfaces . . . . . . . . . . . . . . . . . . . . . 306
11.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
11.7 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
11.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
12 Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
12.1 The Value of Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
12.2 SimpleDB Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
12.3 Static Hash Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
12.4 Extendable Hash Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
12.5 B-Tree Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
12.6 Index-Aware Operator Implementations . . . . . . . . . . . . . . . . . 345
12.7 Index Update Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
12.8 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
12.9 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
12.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
13 Materialization and Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
13.1 The Value of Materialization . . . . . . . . . . . . . . . . . . . . . . . . . 363
13.2 Temporary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
xii Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
About the Author
xiii
Chapter 1
Database Systems
Database systems play an important role in the computer industry. Some database
systems (such as Oracle) are enormously complex and typically run on large, high-
end machines. Others (such as SQLite) are small, streamlined, and intended for the
storage of application-specific data. Despite their wide range of uses, all database
systems have similar features. This chapter examines the issues that a database
system must address and the capabilities it is expected to have. It also introduces
the Derby and SimpleDB database systems, which will be discussed in this book.
• There is an ENROLL record for each course taken by a student. Each record
contains the enrollment ID number, the ID numbers of the student and the section
of the course taken, and the grade the student received for the course.
Figure 1.1 is just a conceptual picture of some records. It does not indicate
anything about how the records are stored or how they are accessed. There are
many available software products, called database systems, which provide an
extensive set of features for managing records.
What does it mean to “manage” records? What features must a database system
have, and which features are optional? The following five requirements seem
fundamental:
• Databases must be persistent. Otherwise, the records would disappear as soon as
the computer is turned off.
• Databases can be shared. Many databases, such as our university database, are
intended to be shared by multiple concurrent users.
• Databases must be kept accurate. If users cannot trust the contents of a database,
it becomes useless and worthless.
• Databases can be very large. The database of Fig. 1.1 contains only 29 records,
which is ridiculously small. It is not unusual for a database to contain millions
(or even billions) of records.
• Databases must be usable. If users are not able to easily get at the data they want,
their productivity will suffer, and they will clamor for a different product.
1.1 Why a Database System? 3
A common way to make a database persistent is to store its records in files. The
simplest and most straightforward approach is for a database system to store records
in text files, one file per record type; each record could be a line of text, with its
values separated by tabs. Figure 1.2 depicts the beginning of the text file for the
STUDENT records.
This approach has the advantage that a user could examine and modify the files
with a text editor. Unfortunately, the approach is too inefficient to be useful, for two
reasons.
The first reason is that large text files take too long to update. Suppose, for
example, that someone deletes Joe’s record from the STUDENT file. The database
system would have no choice but to rewrite the file beginning at Amy’s record,
moving each succeeding record to the left. Although the time required to rewrite a
small file is negligible, rewriting a 1 gigabyte file could easily take several minutes,
which is unacceptably long. A database system needs to be much more clever about
how it stores records, so that updates to the file require only small, local rewrites.
The second reason is that large text files take too long to read. Consider searching
the STUDENT file for the students in the class of 2019. The only way is to scan the file
sequentially. Sequential scanning can be very inefficient. You probably know several
in-memory data structures, such as trees and hash tables, which enable fast searching.
A database system needs to use analogous data structures to implement its files. For
example, a database system might organize the records in a file using a structure that
facilitates one particular type of search (e.g., on student name, graduation year or
major), or it might create multiple auxiliary files, each facilitating a different type of
search. These auxiliary files are called indexes and are the subject of Chap. 12.
When many users share a database, there is a good chance that they will be accessing
some of its data files concurrently. Concurrency is a good thing, because each user
can be served quickly without having to wait for the other users to finish. But too
4 1 Database Systems
much concurrency is bad, because it can cause the database to become inaccurate.
For example, consider a travel-planning database. Suppose that two users try to
reserve a seat on a flight that has 40 seats remaining. If both users concurrently read
the same flight record, they both will see the 40 available seats. They both then
modify the record so that the flight now has 39 available seats. Oops. Two seats have
been reserved, but only one reservation has been recorded in the database.
A solution to this problem is to limit concurrency. The database system should
allow the first user to read the flight record and see the 40 available seats and then
block the second user until the first user finishes. When the second user resumes, it
will see 39 available seats and modify it to 38, as it should. In general, a database
system must be able to detect when a user is about to perform an action that conflicts
with an action of another user and then (and only then) block that user from
executing until the first user has finished.
Users also may need to undo database updates they have made. For example,
suppose that a user has searched the travel-planning database for a trip to Madrid and
found a date for which there is both an available flight and a hotel with a vacancy.
Now suppose that the user reserves the flight, but while the reservation process is
occurring, all of the hotels for that date fill up. In this case, the user may need to undo
the flight reservation and try for a different date.
An update that is undoable should not be visible to the other users of the database.
Otherwise, another user may see the update, think that the data is “real,” and make a
decision based on it. The database system must therefore provide users with the
ability to specify when their changes are permanent; the user is said to commit the
changes. Once a user commits, the changes become visible and cannot be undone.
Chapter 5 examines these issues.
Suppose that you are running a program that gives a pay raise to all professors, when
the database system unexpectedly crashes. After the system restarts, you realize that
some of the professors have a new salary, but others don’t. What should you do?
You can’t just rerun the program because that would give some professors a double
pay raise. Instead, you need the database system to recover gracefully from the crash,
undoing the updates of all programs that were running when the crash occurred. The
mechanism for doing so is interesting and nontrivial, and is examined in Chap. 5.
Databases need to be stored in persistent memory, such as disk drives or flash drives.
Flash drives are about 100 times faster than disk drives but are also significantly
more expensive. Typical access times are about 6 ms for disk and 60 μs for flash.
However, both of these times are orders of magnitude slower than main memory
1.1 Why a Database System? 5
(or RAM), which has access times of about 60 ns. That is, RAM is about 1000 times
faster than flash and 100,000 times faster than disk.
To see the effect of this performance difference and the consequent problems
faced by a database system, consider the following analogy. Suppose you crave a
chocolate chip cookie. There are three ways to get one: from your kitchen, at the
neighborhood grocery store, or via mail order. In this analogy, your kitchen corre-
sponds to RAM, the neighborhood store corresponds to a flash drive, and the mail
order company corresponds to a disk. Suppose that it takes 5 seconds to get the
cookie from your kitchen. Getting the cookie from the analogous store would require
5000 seconds, which is over an hour. This means going to the store, waiting in a very
long line, buying the cookie, and returning. And getting the cookie from the
analogous mail order company would require 500,000 seconds, which is over
5 days. That means ordering the cookie online and having it shipped using standard
delivery. From this point of view, flash and disk memory look terribly slow.
Wait! It gets worse. Database support for concurrency and reliability slows things
down even more. If someone else is using the data you want, then you may be forced
to wait until the data is released. In our analogy, this corresponds to arriving at the
grocery store and discovering that the cookies are sold out, forcing you to wait until
they are restocked.
In other words, a database system is faced with the following conundrum: It must
manage more data than main memory systems, using slower devices, with multiple
people fighting over access to the data, and make it completely recoverable, all the
while maintaining a reasonable response time.
A large part of the solution to this conundrum is to use caching. Whenever the
database system needs to process a record, it loads it into RAM and keeps it there for
as long as possible. Main memory will thus contain the portion of the database that is
currently in use. All reading and writing occur in RAM. This strategy has the
advantage that fast main memory is used instead of slow persistent memory but
has the disadvantage that the persistent version of the database can become out of
date. The database system needs to implement techniques for keeping the persistent
version of the database synchronized with the RAM version, even in the face of a
system crash (when the contents of RAM is destroyed). Chapter 4 considers various
caching strategies.
1.1.5 Usability
A database is not very useful if its users cannot easily extract the data they want. For
example, suppose that a user wants to know the names of all students who graduated
in 2019. In the absence of a database system, the user would be forced to write a
program to scan the student file. Figure 1.3 gives the Java code for such a program,
assuming that the file is stored as text. Note that most of the Java code deals with
decoding the file, reading each record and splitting it into an array of values to be
examined. The code to determine the desired student names (in bold) is hidden
within the uninteresting file-manipulation code.
6 1 Database Systems
Consequently, most database systems support a query language, so that users can
easily specify their desired data. The standard query language for relational data-
bases is SQL. The code of Fig. 1.3 can be expressed by the single SQL statement:
This SQL statement is much shorter and clearer than the Java program, primarily
because it specifies the values to be extracted from the file without having to specify
how to retrieve them.
Learning database concepts is much more effective if you can use a database system
to follow along interactively. Although there are a wide variety of available database
systems, I suggest that you use Derby database system because it is Java-based, free,
easy to install, and easy to use. The latest version of Derby can be downloaded from
the downloads tab at the URL db.apache.org/derby. The downloaded
distribution file unpacks to a folder containing several directories. For example,
the docs directory contains reference documentation, the demo directory contains a
sample database, and so on. The full system contains many more features than can be
covered here; the interested reader can peruse the various guides and manuals in the
docs directory.
Derby has many features that are not needed in this book. In fact, you only need to
add four files from Derby’s lib directory to your classpath: derby.jar,
derbynet.jar, derbyclient.jar, and derbytools.jar. There are
many ways to change your classpath, depending on your Java platform and operat-
ing system. I will explain how to do it using the Eclipse development platform. If
you are not familiar with Eclipse, you can download its code and documentation
1.2 The Derby Database System 7
from eclipse.org. If you use a different development platform, then you should
be able to adapt my Eclipse directions to fit your environment.
First, create an Eclipse project for Derby. Then configure its build path, as
follows. From the Properties window, select “Java Build Path.” Click on the
“Libraries” tab and then “Add External JARS,” and use the file chooser to select the
four jar files you need. That’s it.
The Derby distribution contains an application, called ij, which enables you to
create and access Derby databases. Because Derby is written completely in Java, ij
is actually the name of a Java class, located in the package org.apache.derby.
tools. You run ij by executing its class. To execute the class from Eclipse, go to
“Run Configurations” in the Run menu. Add a new configuration to your Derby
project; call it “Derby ij.” In the field for the configuration’s main class, enter “org.
apache.derby.tools.ij.” When you run the configuration, ij displays a console
window that asks for input.
Input to ij is a sequence of commands. A command is a string that ends with a
semicolon. Commands can be split over several lines of text; the ij client will not
execute a command until it encounters a line ending in a semicolon. Any SQL
statement is a legal command. In addition, ij supports commands to connect and
disconnect from a database and to exit the session.
The connect command specifies the database that ij should connect to, and
the disconnect command disconnects from it. A given session can connect and
disconnect multiple times. The exit command ends the session. Figure 1.4 shows
an example ij session. The session has two parts. In the first part, the user connects
to a new database, creates a table, inserts a record into that table, and disconnects. In
the second part, the user reconnects to that database, retrieves the inserted values,
and disconnects.
The argument to the connect command is called its connection string. The
connection string has three substrings, separated by colons. The first two substrings
are “jdbc” and “derby,” indicating that you want to connect to a Derby database
using the JDBC protocol. (JDBC is the topic of Chap. 2.) The third substring
1 row selected
ij> disconnect;
ij> exit;
identifies the database. The string “ijtest” is the name of the database; its files will be
in a folder named “ijtest”, located in the directory from which the ij program was
launched. For example, if you ran the program from Eclipse, the database folder will
be in the project directory. The string “create ¼ true” tells Derby to create a new
database; if it is omitted (as in the second connection command), then Derby expects
to find an existing database.
1
Of course, if you allow clients to connect from anywhere, then you expose the database to hackers
and other unscrupulous users. Typically, you would either place such a server inside of a firewall,
enable Derby’s authentication mechanism, or both.
10 1 Database Systems
simply changing the connect commands. The other commands in the session are
unaffected.
jdbc:simpledb:testij
jdbc:simpledb://localhost
jdbc:simpledb://cs.bc.edu
1.5 The SimpleDB Version of SQL 11
Derby implements nearly all of standard SQL. SimpleDB, on the other hand,
implements only a tiny subset of standard SQL and imposes restrictions not present
in the SQL standard. This section briefly indicates these restrictions. Other chapters
of the book explain them in more detail, and many end-of-chapter exercises will ask
you to implement some of the omitted features.
A query in SimpleDB consists only of select-from-where clauses in which the
select clause contains a list of field names (without the AS keyword), and the
from clause contains a list of table names (without range variables).
The terms in the optional where clause can be connected only by the boolean
operator and. Terms can only compare constants and fieldnames for equality.
12 1 Database Systems
Unlike standard SQL, there are no other comparison operators, no other boolean
operators, no arithmetic operators or built-in functions, and no parentheses. Conse-
quently, nested queries, aggregation, and computed values are not supported.
Because there are no range variables and no renaming, all field names in a query
must be disjoint. And because there are no group by or order by clauses,
grouping and sorting are not supported. Other restrictions are:
• The “” abbreviation in the select clause is not supported.
• There are no null values.
• There are no explicit joins or outer joins in the from clause.
• The union keyword is not supported.
• An insert statement takes explicit values only. That is, an insertion cannot be
specified by a query.
• An update statement can have only one assignment in the set clause.
engine. A program having a server-based connection shares the engine with other
concurrent programs.
• Two Java-based database systems are Derby and SimpleDB. Derby implements
the full SQL standard, whereas SimpleDB implements only a limited subset of
SQL. SimpleDB is useful because its code is easy to understand. The rest of this
book starting in Chap. 3 will examine this code in detail.
Database systems have undergone dramatic changes over the years. A good account
of these changes can be found in Chap. 6 of National Research Council (1999) and in
Haigh (2006). The Wikipedia entry at en.wikipedia.org/wiki/Data
base_management_system#History is also interesting.
The client-server paradigm is useful in numerous areas of computing, not just
databases. A general overview of the field can be found in Orfali et al. (1999).
Documentation on the various features and configuration options of the Derby server
can be found at the URL db.apache.org/derby/manuals/index.html.
Haigh, T. (2006). “A veritable bucket of facts”. Origins of the data base management
system. ACM SIGMOD Record, 35(2), 33–49.
National Research Council Committee on Innovations in Computing and Commu-
nications. (1999). Funding a revolution. National Academy Press. Available from
www.nap.edu/read/6323/chapter/8#159
Orfali, R., Harkey, D., & Edwards, J. (1999). Client/server survival guide (3rd ed.).
Wiley.
1.8 Exercises
Conceptual Exercises
1.1. Suppose that an organization needs to manage a relatively small number of
shared records (say, 100 or so).
(a) Would it make sense to use a commercial database system to manage these
records?
(b) What features of a database system would not be required?
(c) Would it be reasonable to use a spreadsheet to store these records? What are
the potential problems?
1.2. Suppose you want to store a large amount of personal data in a database. What
features of a database system wouldn’t you need?
1.3. Consider some data that you typically manage without a database system (such
as a shopping list, address book, checking account info, etc.).
Random documents with unrelated
content Scribd suggests to you:
Or look at the painting of another vault on the opposite page. This is
more stiff than the former, because it was executed nearly a century
later; still, there is nothing to declare its Christian character until the
eye rests on the Good Shepherd, who appears below the principal
part of the decoration.
We are not saying that the artists who executed these paintings
had no Christian meaning in them; on the contrary, we believe that
they had, and that the paintings really suggested that meaning to
those who first saw them. For we know, on the authority of Tertullian,
that “the whole revolving order of the seasons” (which are
represented in the second painting) was considered by Christians to
be “a witness of the resurrection of the dead.” This, therefore, was
probably the reason why they were painted here; and no Christian
needs to be reminded that our Lord spoke of Himself under the
image of a vine, which sufficiently explains the first painting. Still the
fact remains that the representations themselves are such as might
have been used by Christian and by Pagan artists indifferently. If any
of our readers feel disappointed that the first essays of the Christian
painter should not have had a more distinctly Christian character,
they must remember that a new art cannot be created in a moment.
If the Christian religion in its infancy was to make use of art at all, it
had no choice but to appropriate to its own purposes the forms of
ancient art, so far as they were pure and innocent; by degrees it
would proceed to eliminate what was unmeaning, and substitute
something Christian.
Some writers have supposed that Christians used at first Pagan
subjects as well as Pagan forms of ornamentation; and they point to
the figure of Orpheus, which appears in three or four places of the
Catacombs, and to that of Psyche also, which may be seen about as
often. So insignificant a number of exceptions, however, would
scarcely suffice to establish the general proposition, even if they
were in themselves inexplicable. But, in truth, the figure of Orpheus
has no right to be considered an exception at all, for he was taken by
some of the early Fathers as a type of our Lord; and it was even
believed by some of them, that, like the sybil, he had prophesied
about Him. Clement of Alexandria calls our Lord the Divine
enchanter of souls, with evident reference to the tale of Orpheus;
and the same idea will have occurred to every classical scholar, as
often as he has heard those words of the Psalmist which speak of
the wicked as “refusing to hear the voice of the charmer, charm he
never so wisely.” When, then, we find Orpheus and his lyre, and the
beasts enchanted by his song, figured on the walls or roofs of the
Catacombs, we have a right to conclude that the artist intended a
Christian interpretation to be given to his work; and a similar
explanation may be given of any other subjects of heathen
mythology which have gained admittance there.
If we were asked to name the subject which seems to have been
used most frequently in the early decorations of the Catacombs, we
should give the palm to the Good Shepherd; nor is this preference to
be wondered at. Any one who has meditated upon the words in
which our Blessed Lord took this title to Himself, will easily
understand why the first Christians, living in the midst of heathen
persecutors, should have delighted to keep so touching an image
always before them. They scratched it, therefore, roughly on the
tombstone as they laid some dear one in the grave; they carved it on
their cups, especially on the sacred chalice; they engraved it on
signet rings and wore it on their fingers; they placed it in the centre of
the paintings with which they covered the ceiling of their
subterranean chapels, or they gave it the chief place immediately
over the altar. We meet with it everywhere, and everybody can
recognise it.
There are, however, one or two peculiarities in its mode of
treatment which require a word of explanation. The shepherd is
generally represented as a young man lightly clad, with his tunic girt
high about his loins, denoting thereby his unwearied activity; he is
surrounded by sheep, or he carries one on his shoulders, bearing it
home to the fold,—the most tender act of his office. And there is
nothing in this but what we might naturally have expected. But he is
also sometimes represented with a goat instead of a sheep upon his
shoulders; and, in later paintings, he has the pastoral reed or tuneful
pipe either hanging on the tree by his side or he is playing on it. Now
this last particular has no place in the gospel parable, and the former
seems directly opposed to it, since the goat is the accepted symbol
of the wicked, the sheep only of the good. Hence these points have
been taken up by some critics, either as tokens of thoughtless
carelessness on the part of the Christian artists, or as proofs that
their work, whether consciously or unconsciously, was merely copied
from some Pagan original. Neither of these remarks appears to be
just. The images of a shepherd in Pagan art, with scarcely a single
exception, are of a very different kind; and the particular details
objected to are not only capable of receiving a Christian
interpretation, they even express consoling Christian truths. St.
Gregory Nazianzen speaks of the anxious care of the shepherd as
he sits on the hillside, filling the air with the soft notes of his pipe,
calling together his scattered flock; and he observes that in like
manner the spiritual pastor, desirous to recall souls to God, should
follow the example of his Divine Master, and use his pipe more
frequently than his staff. Then, as to the substitution of the goat for
the sheep, it was probably intended as a distinct protest against the
un-Christian severity of those heretics, who in very early times
refused reconciliation to certain classes of penitent sinners.
Not many, however, of the most ancient Christian paintings are of
the same simple and obvious character as the Good Shepherd. The
leading feature which characterises most of them is this, that they
suggest religious ideas or doctrines under the guise of artistic
symbols or historic types. One doctrine specially prominent in them,
and most appropriately taught in cemeteries, is that of the
resurrection and the everlasting life of happiness which awaits the
souls of the just after death. It is in this sense that we must
understand not only the frequent repetitions of the stories of Jonas
and of Lazarus—the type and the example of a resurrection—but
also of Daniel in the lions’ den, and the three children in the fiery
furnace. These last, indeed, very probably had reference also to the
persecution which the Christians were then suffering, and were
intended to inspire courage and a confident expectation that God
would deliver them, even as He had delivered His chosen servants
of old; but, as they are spoken of in very ancient Christian
documents (e.g., in the hymns of St. Ephrem and in the Apostolic
Constitutions) as foreshadowing the future triumph of the body over
death, whence these too had been in a manner delivered, we prefer,
in obedience to these ancient guides, to assign this interpretation to
them; at any rate, it is certain that this interpretation cannot be
excluded. Figures also of the deceased, with arms outstretched in
prayer, sometimes accompanied by their names, or standing in the
midst of a garden, or, again, figures of birds pecking at fruits and
flowers, we understand as images of the soul still living after death,
received into the garden of Paradise, and fed by immortal fruits.
Sometimes there may be a difference of opinion perhaps as to the
correctness of this or that interpretation suggested for any particular
symbolical painting; but the soundness of the principle of
interpretation in itself cannot be called in question, nor will there
often be any serious difficulty in its application, among those who
study the subject with diligence and candour. The language, both of
Holy Scripture and of the earliest Fathers, abounds in symbols, and
it was only natural that the earliest specimens of Christian art should
exhibit the same characteristic. More was meant by them than that
which met at first the outward senses; without this clue to their
meaning, the paintings are scarcely intelligible,—with it, all is plain
and easy.
Tombstone from the very ancient Crypt of St. Lucina, now united with the
Catacomb of St. Callixtus.
Ι ΗϹΟΥϹ = Jesus
Χ ΡΙϹΤΟϹ = Christ
Θ ΕΟΥ = of God
Υ ΙΟϹ = Son
Ϲ ΩΤΗΡ = Saviour
The Greek for fish is here written perpendicularly, one letter above
another, ΙΧΘΥϹ; and it is seen that these five letters are the initial
letters of five words, which, together, contain a tolerably complete
account of what Christ is. He is Jesus Christ, Son of God,
Saviour. Thus, this one word, ιχθυς, or fish, read in this way, tells a
great deal about our Lord’s name and titles; it is almost a miniature
creed, or, as one of the Fathers expresses it, “it contains in one
name a whole multitude of holy names.” It would take us too long to
enquire into the origin of this device for expressing our Lord’s name
and titles in so compendious and secret a form. Clearly, whoever
may have invented it, it was very ingenious, and specially convenient
at those times and places where men dared not speak of Him freely
and openly. We cannot say when it began, but it was in universal use
throughout the Church during the first three hundred years of her life,
and then, when she was in the enjoyment of peace and liberty, it
gradually dropped, first out of sight in Christian monuments, and
then out of mind also in Christian literature. But, during the ages of
persecution, it had sunk deep into the habits of Christian thought and
language; it became, as it were, a part of the very Catechism,—
every baptized Christian seems to have been familiar with it, whether
he lived on the banks of the Tiber or of the Po, of the Loire, of the
Euphrates, or of the Nile. In all these parts of the world, writers in
books, poets in hymns, preachers in sermons, artists in painting, the
very masons themselves on gravestones, made use of it without a
word of explanation, in a way that would utterly mystify any modern
Christian community. Who would now dream of carving or painting a
fish upon a gravestone in a Christian churchyard? yet scores of
graves in the Catacombs were so marked, and some of them with
hardly a word or an emblem upon them besides. Or what meaning
could we attach to the picture of a dove or a lamb standing on a
fish’s back, if we did not understand that the fish represented Christ,
and the dove or the lamb a Christian, so that the whole symbol stood
for a Christian soul supported by Christ through the waves and
storms of life? Or again, only imagine a Christian in these days
having buried with him, or wearing round his neck during life, a little
figure of a fish cut in ivory, or crystal, or mother of pearl, or some still
more costly material? Yet a number of those who were buried in the
Catacombs did this; and some of these fish even bear an inscription,
calling upon the fish to be a Saviour!
It was necessary to give this explanation of certain symbols, and
to justify it by sufficient examples, before we proceed to study any of
the more complex paintings in the Catacombs. But now, with these
thoughts in our minds, let us enter the Cemetery of St. Callixtus, and
look on a figure represented two or three times on a wall of one of its
most ancient chambers: a fish swimming and carrying on its back a
basket of bread, and in the midst of the loaves of bread, a glass
vessel containing a red liquid. What is this but bread and wine, the
elements of the Sacrament of Love, and Jesus Christ Its reality? St.
Jerome, when speaking of a holy bishop of Toulouse who had sold
the gold and silver vessels of his church to relieve the poor, uses
these words, “What can be more rich than a man who carries the
body of Christ in a basket of wicker-work, and the blood of Christ in a
vessel of glass?” Here are undeniably the basket of wicker-work and
the vessel of glass; and who can doubt that we have the other also,
veiled under the figure of the fish?
Consecration of the Holy Eucharist.
Sacrifice of Isaac.
Resurrection of Lazarus.
Such is the full meaning of the scene at the Sea of Tiberias, as
interpreted according to the unanimous consent of the Fathers; and
the adjuncts of this picture show that it was intended to be so
understood here also; for on one side is the figure of the
consecration already described; and on the other, the sacrifice of
Isaac by his father, which was surely a most lively type of the
sacrifice of Christ upon the altar; wherein blood is not really shed,
but the Lamb is only “as it were slain,” just as Isaac was not really
slain, but was received back from the dead, “for a parable.” Lastly, as
has been mentioned before, there follows on the third wall of the
same chamber the natural complement of the rest; the doctrine of
the Resurrection, as contained in the fact of the rising again of
Lazarus. Thus, this whole series of paintings, executed at the end of
the second century, or within the first twenty or thirty years of the
third, and repeated (as has been said) in several successive
chambers, was a continual homily, as it were, set before the eyes of
the faithful, in which they were reminded of the beginning, progress,
and consummation of their new and supernatural life.
We do not say that every modern Christian who looks at these
paintings will thus read their meaning at once; but we believe that all
ancient Christians did so, because it is clear from the writings of the
Apostles themselves and their successors, that nothing was more
familiar to the Christian mind of those days than the symbolical and
prophetical meaning of the facts both of the Old and of the New
Testaments. They believed the facts themselves to have taken place
just as they are recorded, but they believed also that they had a
mysterious signification, whereby the truths of the Christian faith
were insinuated or expressed, and that this was their highest and
truest meaning. “Perhaps there is no one recorded miracle of our
Lord,” says St. Gregory, “which is not therefore selected for
recording because it was the type of something to happen in the
Church;” and precisely the same was felt to be true also of the
histories of the patriarchal and Jewish dispensations. “All these
things had happened to them in figure, and they were written for our
correction, upon whom the ends of the world are come.”
It may not be often possible to trace as clearly as we have just
done in a single instance, the logical order and dependence of the
several subjects that were selected for representation in each
chamber of the Catacombs; they may not always have been so
admirably arranged as to be in fact equivalent, as these were, to a
well-ordered dogmatic discourse. Nevertheless it is only when read
in this way, that the decoration of the Catacombs can be made
thoroughly intelligible; and it is certain that some such meaning must
have been intended from the first. The extremely limited number of
Biblical subjects selected for representation, while such an immense
variety is really contained in the Bible (and so many of those that are
neglected might have seemed equally suitable for the purpose), and
then again, the thoroughly unhistorical way in which these few
subjects are dealt with, shows clearly that the principle of selection
was theological rather than artistic. The artists were not left to
indulge their own unfettered fancy, but worked under ecclesiastical
supervision; and the Bible stories which they depicted were not
represented according to their historical verity, because they were
not intended to be a souvenir of past facts, but to symbolise and
suggest something beyond themselves. In order, therefore, to
understand them, it is necessary to bring them face to face with the
Christian doctrines which they foreshadow.
Noe in the Ark.