> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ones1ght.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Database Connector

> Connect to PostgreSQL, MySQL, MS-SQL, Oracle, or MongoDB and read live at query time.

## Overview

The database connector connects to PostgreSQL, MySQL, MS-SQL, Oracle, or MongoDB.
It does not copy and store your data — it **reads live from the DB at query time.**
Because the DB provides column information, there is no header-row step (unlike the file connector).

<Info>
  This screen is available to **Manager and above** (owner, manager) only. Menu visibility `manage`.
</Info>

## Steps

<Steps>
  <Step title="Connect · tables">
    Enter the connection details, use `Connect & list tables` to connect, and select a table or collection.
  </Step>

  <Step title="Data view · filter">
    Review the preview and add filters so only matching rows are used.
  </Step>

  <Step title="Field mapping">
    For each column, set a Meaning (required, standard field name) and Detail (optional).
  </Step>

  <Step title="Register">
    Enter a name and register the data source.
  </Step>
</Steps>

## Connection details (SQL)

| Field             | Description                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------------- |
| Host              | DB server address                                                                             |
| Port              | Defaults — PostgreSQL `5432` · MySQL `3306` · MS-SQL `1433` · Oracle `1521` · MongoDB `27017` |
| Database          | Target database                                                                               |
| Schema (optional) | Schema selection (except MongoDB)                                                             |
| User              | Connection account                                                                            |
| Password          | Connection password (stored AES-256-GCM encrypted)                                            |

### SSL / TLS

| Mode                           | Description                            |
| ------------------------------ | -------------------------------------- |
| Disabled                       | No encryption                          |
| Encrypt (require)              | Transport encryption only              |
| Verify CA (verify-ca)          | Verify the server CA certificate (PEM) |
| Verify CA + host (verify-full) | Verify CA plus the host name           |

<Note>
  Verify modes (verify-ca, verify-full) require a server CA certificate (PEM).
</Note>

### SSH tunnel (optional)

Connect to the DB through a bastion host. Fields: bastion host, port, user, and authentication method (private key PEM or password). Credentials are stored encrypted.

## Reading data

<Tabs>
  <Tab title="Table (SQL)">
    Select a table to query, or write a **custom query**. Custom queries allow only `SELECT` / `WITH` (read-only), and a simple builder can generate a basic `SELECT` statement.
  </Tab>

  <Tab title="MongoDB">
    Select a collection and choose the source mode.

    * **Collection sample**: read a sample from the collection.
    * **Aggregation pipeline**: write a pipeline as a JSON array. `$out` and `$merge` are not allowed (read-only).
  </Tab>
</Tabs>

## Security · editing

<Warning>
  The password is **encrypted with AES-256-GCM** and is never returned to the client.
  When editing, leaving the password field blank keeps the stored value.
</Warning>

<Note>
  In the edit screen the connection target (host, port, database, user) is read-only; only the security settings (SSL, SSH tunnel) and the password can be changed.
</Note>
