7.0.0

# Database

## Scope

This chapter provides an overview over databases supported by SeisComP.

## Overview

SeisComP can store and read information from a relational database management system (RDBMS). Supported are basically all existing RDBMS for which a plugin can be written. Currently, database plugins are provided for

Database | Plugin Name
--- | ---
MySQL / MariaDB | dbmysql
PostgreSQL | dbpostgresql
SQLite3 | dbsqlite3

### Database access

Typically, the database is accessed by the messaging (scmaster) for reading and writing. Most other modules can only read from the database but do not write into it. Among the few exceptions which can also directly write to the database are scdb and scardac.

The database connection provided by the messaging is configured by the scmaster module configuration. Modules connected to the messaging receive the read connection parameters through the messaging connection. However, the default read connection by these and all other modules may be set with `database` in global configuration or set on the command line using `--database` or simply `-d`. Read the sections SeisComP Installation and Getting Started with SeisComP on the installation and the configuration of the database backend and the initial setup of the database itself, respectively.

The database connection may be used together with the debug option to print the database commands along with debug log output. Example for using scolv in offline mode with database debug output:

    scolv -d localhost?debug --offline --debug

### Database schema

The used database schema is well defined and respected by all modules which access the database. It is similar to the SeisComML schema (SCML, a version of XML) and the C++ / Python class hierarchy of the datamodel namespace / package.

Information of the following objects can be stored in the database as set out in the documentation of the data model.

Object | Description
--- | ---
Config | station bindings
DataAvailability | information on continuous data records
EventParameters | derived objects like picks, amplitudes, magnitudes origins, events, etc.
Inventory | station meta data
Journaling | information on commands and actions, e.g., by scevent
QualityControl | waveform quality control parameters

Note

The Config parameters just cover station bindings. Application/module specific configurations (all .cfg files) are not stored in the database and only kept in files.

The currently supported version of the database schema can be queried by any module connecting to the data base using the option `-V`. Example:

    $ scm -V

      scm
      Framework: 6.0.0 Development
      API version: 16.0.0
      Data schema version: 0.12
      GIT HEAD: 5e16580cc
      Compiler: c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
      Build system: Linux 6.2.0-26-generic
      OS: Ubuntu 22.04.3 LTS / Linux

## Related Modules

- scardac

- scdb

- scdbstrip

- scdispatch

- scquery

- scqueryqc

- scxmldump