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

Database error codes and messages

How Exponential reports database errors - the engine's own error number in errorNumber() and in eZDBException, the codes for a duplicate key and a missing table on each driver, the exception classes, standard versus…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/database-administrators/error-codes-and-messages.md

On this page

Database error codes and messages

This page is for database administrators and developers who read Exponential's database errors, or write code that must react to them. It answers: which number a failed statement reports on each engine, how errors reach code, and what the drivers' own messages mean. Source: Operating a site, know your database driver and the drivers in lib/ezdb/classes/.

Contents

  1. The engine's own number
  2. Two error handling modes
  3. Exception classes
  4. Messages and where they appear
  5. Reading an error reference

The engine's own number

A failed statement's error number is the database's own, in $db->errorNumber() and, with exception handling, as getCode() of the eZDBException thrown:

DriverDuplicate keyMissing table
MySQL, MariaDB10621146
PostgreSQL (the SQLSTATE, a string)'23505''42P01'
SQLite (the result code)191
Oracle (the ORA number)1942
MongoDB (errorNumber() only; the driver answers false and throws nothing)11000

Upgrade note: PostgreSQL's errorNumber() was 1 for every error before and is the SQLSTATE now.

Two error handling modes

$db = eZDB::instance();
$db->setErrorHandling( eZDB::ERROR_HANDLING_EXCEPTIONS );
try
{
    $db->query( "INSERT INTO my_table ( id ) VALUES ( 1 )" );
}
catch ( eZDBException $e )
{
    if ( $e->getCode() === 1062 || $e->getCode() === '23505' )   // MySQL, PostgreSQL
        { /* the row is there already */ }
}
$db->setErrorHandling( eZDB::ERROR_HANDLING_STANDARD );
  • Standard (the default): a failed statement is logged and the call returns false; inside a transaction the kernel reports the failure.
  • Exceptions: eZDBException with the engine's code. With it, MySQL on PHP 8.1 and later throws eZDBException instead of PHP's mysqli_sql_exception.
  • The SQLite driver throws inside a transaction; outside one it answers false with errorNumber() set.

Compare codes per engine, never the message text, which differs by engine, version and language.

Exception classes

ClassWhen
eZDBNoConnectionExceptionthe connection could not be opened (after ConnectRetries); the setup wizard and index.php report a database that cannot be reached. On SQLite the message carries the full path of the file
eZDBExceptiona failed statement with exception handling on

Messages and where they appear

MessageWritten byWherePage
"Database implementation not supported: ..."eZDB::instance()var/log/error.logReading and changing settings
"No database handler was found for '...'"the null database eZNullDBthe error pagesame
"SQLite3 extension was not found, the DB handler will not be initialized."eZSQLite3DBerror.logPHP extensions
"database is busy: the transaction could not start within N s, another write held the lock all that time; nothing was written"eZSQLite3DBerror.log, the error pageWrite queue
"the transaction could not start: ...; nothing was written"eZSQLite3DBsamesame
"attempt to write a readonly database"SQLiteerror.logPermissions
"Connection warning: could not set the connection charset to 'utf8'; it is '...'"eZMySQLiDBwarning.log with AlwaysLog[]=warningutf8mb4
"The 'digest' function is not available in your database, and Exponential cannot run without it."the setup wizardthe wizardPostgreSQL
"Failed to parse MongoDB URI: ... 'default' authentication mechanism requires a username"the MongoDB drivererror.logMongoDB
MONGO TODO arrayQuery: tables=[...] caller=...expMongoDBthe logsMongoDB limits
"The database schema could not be read."the upgrade checkthe pageChecking the schema
"The audit index classes are not in the autoload array"createaudittables.phpthe shell6.0.15 update

Reading an error reference

An error page shows a short reference. exp:logs finds the error by that reference and shows the lines of its request, with personal data masked by default (Finding an error by its reference).

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