What Is Base?

From Apache OpenOffice Wiki
Jump to: navigation, search




What Is Base?

Base is the component of Apache OpenOffice that allows the office suite to interact with a wide variety of data sources. For example, a data source could be a list of names and addresses used for producing a mail merge letter. A shop stock list could be a data source managed through AOO.

Documentation note.png Apache OpenOffice uses the terms “Data Source” and “Database” to refer to the same thing, which could be a database such as MySQL or dBase or a spreadsheet or text document holding data.

This chapter covers creating a database, viewing and entering data, and loading the data into OpenOffice documents. It also covers using the Base component of AOO to register other data sources. A data source can be a database, spreadsheet, or text document.

Documentation note.png Base is not a database engine. OpenOffice includes the HSQL database engine in the installation files, which is used by default to manipulate data. All the files created by this engine in the default configuration, called an embedded database, are kept within the Base file. It is possible, and sometimes preferable, to connect Base to an external database engine.

Databases bear a superficial similarity to the more widely encountered spreadsheets, but there are important differences. A database consists of a number of columns or fields that contain the individual pieces of data. Groups of fields make up a table of the database. When creating a table, you also determine the characteristics of each field in the table. This is one key difference from spreadsheets. Each field or column may contain only one kind of data. Within the broad data types of text and numbers, there may be further restrictions. For example, the text might have to contain a certain number of characters or numbers might be restricted to be only integers. These restrictions are applied, if they are desired, when the table is defined. Forms are used to interact with the data tables, either for data entry or viewing. This is another difference from spreadsheets where you routinely directly view and manipulate the data tables. Forms format the data display and enable convenient navigation through the rows or records of a table. Database tables do not have the formatting or interactive tools to support convenient direct viewing, but they hold much more data and allow more flexible handling of lists. A query creates a new temporary table from the existing tables according to instructions you provide. The query may sort, order, filter, summarize and match data from many tables. A report organizes the information of the fields of a query in a document according to your requirements.

Documentation caution.png The database engine in AOO requires a 32-bit Java Runtime Environment (JRE). If you do not have one on your computer, you can download it from www.java.com or adoptopenjdk.net and install it following the instructions on the site. In AOO, use Tools → Options → OpenOffice → Java to register Java.

Base creates relational databases. This makes it fairly easy to create a database in which the fields of the database have relationships with each other.

For example: Consider a database for a library. It will contain a field for the names of the authors and another field for the names of the books. There is an obvious relationship between the authors and the books they have written. The library may contain more than one book by the same author. This is what is known as a one-to-many relationship: one author and more than one book. Most if not all the relationships in such a database are one-to-many relationships.

Consider an employment database for the same library. One of the fields contains the names of the employees while others contain the social security numbers, and other personal data. The relationship between the names and social security numbers is one-to-one: only one social security number for each name.

If you are acquainted with mathematical sets, a relational database can easily be explained in terms of sets: elements, subsets, unions, and intersections. The fields of a database are the elements. The tables are subsets. Relationships are defined in terms of unions and intersections of the subsets (tables).

To explain how to use a database, we will create one for the sales and expenses of a small group of people. It is not intended to be realistic for any purpose; it will merely supply concrete but highly simplified examples of data. In the process, we will be explaining how a database works.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools