> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# SQL adapter

> Reference for configuring the SQL adapter for direct queries or object-relational mapping (ORM), including adapter properties and sample configurations.

The SQL adapter allows interaction with a SQL database. This adapter can be configured for either direct SQL queries or in an object-relational mapping (ORM) configuration. See the sample configurations below for examples of each mode.

Support for SSL/TLS encrypted connections will soon be available.

## Properties

| Property             | Type    | Description                                                                                                                                                                                                                                |
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `host`               | String  | Required. The IP or hostname of the SQL database.                                                                                                                                                                                          |
| `port`               | Number  | Required. The port of the SQL database.                                                                                                                                                                                                    |
| `dbName`             | String  | The name of the SQL database.                                                                                                                                                                                                              |
| `credentials.user`   | String  | The username to use when authenticating with the SQL database.                                                                                                                                                                             |
| `credentials.passwd` | String  | The password to use when authenticating with the SQL database.                                                                                                                                                                             |
| `direct`             | Boolean | Whether a direct connection to the database will be established and exposed.                                                                                                                                                               |
| `orm`                | Boolean | Whether an object-relational mapping connection to the database will be established and exposed.                                                                                                                                           |
| `min`                | Number  | The minimum number of concurrent connections to open. Only used for ORM connections.                                                                                                                                                       |
| `max`                | Number  | The maximum number of concurrent connections to open. Only used for ORM connections.                                                                                                                                                       |
| `acquireTimeout`     | Number  | Milliseconds to wait before declaring an attempt to acquire a database connection has failed. Only used for direct connections. Default: `10000`.                                                                                          |
| `waitForConnection`  | Boolean | Determines the behavior of the adapter when no connections are available. Only used for direct connections. Default: `true`. If `true`, the request is queued until a connection is available. If `false`, the request errors immediately. |
| `connectionLimit`    | Number  | The number of supported concurrent connections. Only used for direct connections. Default: `10`.                                                                                                                                           |
| `queueLimit`         | Number  | The maximum number of connection requests allowed in the connection queue. Only used for direct connections. Default: `10`.                                                                                                                |

## Direct configuration

Configure at minimum the following properties before deploying:

* `host`
* `port`
* `dbName`
* `credentials.user`
* `credentials.passwd`

```json
{
  "id": "mysql",
  "type": "MySQLDriver",
  "properties": {
    "host": "localhost",
    "port": 8888,
    "dbName": "peering_insights",
    "credentials": {
      "user": "pronghorn",
      "passwd": "$ENC87eb897b507afc1796db49409dd026188a832188a7d7439b"
    },
    "direct": true,
    "orm": false,
    "acquireTimeout": 10000,
    "waitForConnection": true,
    "connectionLimit": 10,
    "queueLimit": 10
  }
}
```

## ORM configuration

Configure at minimum the following properties before deploying:

* `host`
* `port`
* `dbName`
* `credentials.user`
* `credentials.passwd`

```json
{
  "id": "mysql",
  "type": "MySQLDriver",
  "properties": {
    "host": "localhost",
    "port": 8888,
    "dbName": "peering_insights",
    "credentials": {
      "user": "pronghorn",
      "passwd": "$ENC87eb897b507afc1796db49409dd026188a832188a7d7439b"
    },
    "direct": false,
    "orm": true,
    "min": 3,
    "max": 7
  }
}
```