Computers were originally invented for the purpose of processing very complex formulas. One of the first uses of computers was to calculate the trajectory of a missile so that it could hit its target with more accuracy.
Immediately after World War II, the United States Census Bureau began using computers to handle massive amounts of data, none of which required complex calculations. The computer was seen as a management, not a computational tool.
Originally, the data that was processed by the Census Bureau and other early adopters of this technology was stored on sequential storage devices in the form of paper tape or IBM punch cards. The inadequacy of this approach soon became evident and the ancestor of the modern disk drive was invented.
The disk drive allowed the program to keep its data inside the computer where it could be read and rewritten with little user intervention. This development caused software engineers and researchers to question whether sequential access was the best way to organize and process data.
One of the problems with sequential access is positional dependence. It requires the program to find data in a record by counting bytes. It also requires the program to read n records that it is not currently interested in to obtain access to the nth + 1 record, a very inefficient approach. What was needed was a way to access a single row in a database directly.
To address these problems, a class of software products was introduced called database management systems (DBMS). The DBMS stores its data in a file called a database. Unlike sequential files, databases stored their data in a structured format. The database consists of not only the data, but also a healthy amount of metadata, with the main types being schemas and indices. The schemas describe the location of the data in the rows of the tables, and the indices provide the addresses of the rows in the database so that the direct retrieval of a single row is possible.
Databases have proven to be so popular that the majority of business and governmental software use databases as their primary data storage mechanism. Figure 19.1 shows how databases and database management systems are organized.
Figure 19.1. The DBMS software understands how to use the schemas and indices to access data quickly.
Your program makes calls to the DBMS using JDBC. The DBMS software is written to understand the exact formats of the tables in this database. It uses the schema information to locate the fields that it needs to satisfy your program's request and sends the results back to your program for processing or display. The indices are used when the DBMS determines that they can speed up processing. An index is normally constructed to provide a shortcut to access data that has a specific value in one of its columns.