Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

The database layer in one page

How Exponential reaches its database, explained for database administrators - the eZDB entry point, the driver aliases, the five driver classes, the schema handlers, what is stored in the database and what is not, and…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/database-administrators/the-database-layer-in-one-page.md

On this page

The database layer in one page

This page is for database administrators who meet Exponential for the first time and want to know how the application talks to the database before they touch a server. It answers: which code opens the connection, how the driver is chosen, what the drivers do differently, which tools turn the engine-neutral schema into DDL, and what is kept in the database as opposed to files. Every class and file named here exists in the 6.0.x kernel.

Contents

  1. One entry point: eZDB
  2. Drivers and their aliases
  3. Schema handlers
  4. What is in the database, and what is not
  5. Caches between the site and the database
  6. Where the pieces live
  7. What this means for your work

One entry point: eZDB

Every part of Exponential reaches the database through eZDB::instance() (lib/ezdb/classes/ezdb.php). It reads site.ini [DatabaseSettings] DatabaseImplementation, looks the value up in ImplementationAlias[], creates the driver object and keeps it for the rest of the request.

All drivers implement one interface, eZDBInterface (lib/ezdb/classes/ezdbinterface.php): connect, query(), arrayQuery() with offset and limit, transactions, lastSerialID(), escapeString() and helpers for what differs between engines (subString(), concatString(), md5(), bitAnd(), bitOr()).

If the alias names no class, the request does not stop at once. eZDB::instance() returns a null database (eZNullDB, lib/ezdb/classes/eznulldb.php) and writes "Database implementation not supported" to var/log/error.log. Every page that needs content then fails, so a typing error looks like a database that is down (9.1).

Drivers and their aliases

EngineAlias in DatabaseImplementationClassFile
SQLite 3sqlite3eZSQLite3DBlib/ezdb/classes/ezsqlite3db.php
PostgreSQLezpostgresql, postgresql, pgsqleZPostgreSQLDBlib/ezdb/classes/ezpostgresqldb.php
MongoDBmongodbexpMongoDBlib/ezdb/classes/expmongodb.php
MariaDB, MySQLezmysqli, mysqli, ezmysql, mysqleZMySQLiDBlib/ezdb/classes/ezmysqlidb.php
Oracleezoracle, oracleeZOracleDBthe ezoracle extension

The kernel aliases are in settings/site.ini; the Oracle aliases are added by the extension's own site.ini.append.php when it is active. Code can ask which engine it runs on: eZDB::instance()->databaseName() returns sqlite, postgresql, mongo, mysql or oracle (and null for the null database).

Two drivers do more than pass SQL through:

  • SQLite registers the functions SQLite lacks (md5(), the BIT_OR and BIT_AND aggregates), rewrites MySQL's UPDATE ... JOIN, ignores MySQL-only SET statements and queues writers (SQLite 3 for database administrators).
  • MongoDB never runs SQL: the adapter translates the kernel's SQL-shaped calls into MongoDB operations (MongoDB: limits and operations).

Schema handlers

The schema is kept in an engine-neutral format, .dba (share/db_schema.dba, share/db_data.dba). A schema handler turns it into the DDL of one engine and reads a live database back into the same format. The handlers are registered in settings/dbschema.ini [SchemaSettings]:

TypeClassFile
mysql, mysqlieZMysqlSchemalib/ezdbschema/classes/ezmysqlschema.php
postgresqleZPgsqlSchemalib/ezdbschema/classes/ezpgsqlschema.php
sqlite, sqlite3eZSQLiteSchemalib/ezdbschema/classes/ezsqliteschema.php
mongoexpMongoSchemalib/ezdbschema/classes/expmongoschema.php
oracleeZOracleSchemathe ezoracle extension

The installers, the schema tools (ezsqldumpschema.php, ezsqlinsertschema.php) and the upgrade check all go through these handlers. See The .dba schema format.

What is in the database, and what is not

In the databaseNot in the database
Content objects, versions, fields, the node tree, URL aliasesUploaded images and files: var/storage (and var/<site>/storage)
Content classes, sections, object statesSettings: INI files in settings/ and the extensions
Users, roles, policies, user visitsCaches: files under var/cache and var/<site>/cache
The built-in search indexLogs: var/log/
Sessions, when ezpSessionHandlerDB is usedSessions with the default PHP handler (PHP's own storage)
Queues (ezpending_actions), workflows, the shopTemplates and designs
The installed version (ezsite_data)The maintenance switch (var/maintenance.json)

A database backup alone is therefore not a backup of the site; see Backups per engine.

Caches between the site and the database

Most page views never reach the database: Velocity's response cache, the content view cache and the template-block cache answer first, and the optional SQL query cache (settings/querycache.ini, Mode=off by default) answers repeated SELECT statements on every engine except MongoDB. A write made outside Exponential, with a SQL client or a restore, is not seen by these caches; clear them afterwards (The SQL query cache, Performance and scaling).

Where the pieces live

WhatWhere
Connection settingssettings/site.ini [DatabaseSettings], overridden in settings/override/site.ini.append.php
Driverslib/ezdb/classes/
Schema handlerslib/ezdbschema/classes/, registered in settings/dbschema.ini
Shipped schema and datashare/db_schema.dba, share/db_data.dba, kernel/sql/<engine>/
Update filesupdate/database/<engine>/<version>/
Schema toolsbin/php/ezsqldumpschema.php, ezsqlinsertschema.php, ezsqldiff.php
MongoDB helpersbin/mongodb/

What this means for your work

  • The database account is the only credential the application needs; it lives in one override file (Securing the database).
  • Schema changes come from update files and the schema tools, never from hand edits (Upgrades and the SQL update files).
  • After any write outside the application, clear the caches.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x