# Database Errors

Database errors occur when storing or retrieving data in the local database. WCPOS uses a local database to store products, customers, and other data for fast access and offline functionality. These errors are prefixed with `DB`.

## Categories[​](#categories "Direct link to Categories")

| Category                         | Code Range | Description                                |
| -------------------------------- | ---------- | ------------------------------------------ |
| [Connection](#connection-errors) | DB01xxx    | Database connection and transaction issues |
| [Data](#data-errors)             | DB02xxx    | Record and constraint issues               |
| [Query](#query-errors)           | DB03xxx    | Query syntax and data type issues          |

***

## Connection Errors[​](#connection-errors "Direct link to Connection Errors")

Issues connecting to or operating on the local database.

| Code                               | Name               | Description                             |
| ---------------------------------- | ------------------ | --------------------------------------- |
| [DB01001](/error-codes/DB01001.md) | Connection Failed  | Could not connect to the local database |
| [DB01002](/error-codes/DB01002.md) | Query Timeout      | Database query took too long            |
| [DB01003](/error-codes/DB01003.md) | Transaction Failed | Database transaction could not complete |

## Data Errors[​](#data-errors "Direct link to Data Errors")

Issues with records, duplicates, and constraints.

| Code                               | Name                 | Description                          |
| ---------------------------------- | -------------------- | ------------------------------------ |
| [DB02001](/error-codes/DB02001.md) | Duplicate Record     | A record with this ID already exists |
| [DB02002](/error-codes/DB02002.md) | Record Not Found     | The requested record does not exist  |
| [DB02003](/error-codes/DB02003.md) | Constraint Violation | Data violates database constraints   |

## Query Errors[​](#query-errors "Direct link to Query Errors")

Issues with query syntax and data types.

| Code                               | Name                   | Description                            |
| ---------------------------------- | ---------------------- | -------------------------------------- |
| [DB03001](/error-codes/DB03001.md) | Query Syntax Error     | The database query has syntax errors   |
| [DB03002](/error-codes/DB03002.md) | Invalid Data Type      | Data type does not match expected type |
| [DB03003](/error-codes/DB03003.md) | Missing Required Field | A required field is empty              |
