# Database

> See the [Database guide](/version-0.x/guide/database-guide.md) to learn how to work with the Database module.

## Configuration

* **`providers`** A hash array of the available [database providers](/version-0.x/guide/database-guide.md#database-providers), where the key is the name of the database provider, and the value is a hash array with the following possible keys:
  * **`providerClassName`** The name of the cache provider class, from the available ones:
    * `DatabaseProviderMysql` To connect to MySQL or MariaDB database servers.
  * **`config`** A hash array of configuration options for the database provider, where each different cache provider has different available config keys:
    * For `DatabaseProviderMysql`:
      * **`host`** The host name or IP of the server.
      * **`user`** The user name
      * **`password`** The password
      * **`database`** The name of the database
      * **`charset`** The character set to use. One of the available here: <https://dev.mysql.com/doc/refman/8.0/en/charset-charsets.html>.
      * **`cacheKeyPrefix`** The cache prefix to use when caching data from the database. Default: `Database`
      * **`cacheDefaultTtl`** The default [TTL](/version-0.x/guide/cache-guide.md#time-to-live) to use when caching data from the database. Default: `CACHE_TTL_NORMAL`
      * **`cacheProviderName`** The default cache provider name to use when caching data from the database. Default: `engine`

## Constants

* **`DATABASE_FIELD_TYPE_INTEGER`**
* **`DATABASE_FIELD_TYPE_TINYINT`**
* **`DATABASE_FIELD_TYPE_FLOAT`**
* **`DATABASE_FIELD_TYPE_DATE`**
* **`DATABASE_FIELD_TYPE_DATETIME`**
* **`DATABASE_FIELD_TYPE_TIMESTAMP`**
* **`DATABASE_FIELD_TYPE_TIME`**
* **`DATABASE_FIELD_TYPE_YEAR`**
* **`DATABASE_FIELD_TYPE_STRING`**
* **`DATABASE_FIELD_TYPE_TEXT`**
* **`DATABASE_FIELD_TYPE_BLOB`**
* **`DATABASE_FIELD_TYPE_BOOLEAN`**
* **`DATABASE_FIELD_TYPE_IP`**
* **`DATABASE_FIELD_TYPE_SERIALIZED`**
* **`DATABASE_FIELD_TYPE_COLOR`**
* **`DATABASE_FIELD_DEFAULT_VALUE`**
* **`DATABASE_FIELD_DEFAULT_VALUE_DATE`**
* **`DATABASE_FIELD_DEFAULT_VALUE_DATETIME`**
* **`DATABASE_FIELD_DEFAULT_VALUE_TIMESTAMP`**
* **`DATABASE_FIELD_DEFAULT_VALUE_TIME`**
* **`DATABASE_FIELD_DEFAULT_VALUE_YEAR`**
* **`DATABASE_FIELD_DEFAULT_VALUE_IP`**
* **`DATABASE_FIELD_DEFAULT_VALUE_AVAILABLE_URL_SHORT_CODE`**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cherrycake.tin.cat/version-0.x/reference/core-modules/database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
