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

# CockroachDB

> Connect your CockroachDB Cloud database to VexiData.

CockroachDB is PostgreSQL wire-compatible, so you connect it as a PostgreSQL database in VexiData.

## Prerequisites

* A [CockroachDB Cloud](https://cockroachlabs.cloud) account with a cluster
* A [VexiData](https://vexidata.com) account

## Connect CockroachDB to VexiData

<Steps>
  <Step title="Get your connection details">
    1. Log in to the [CockroachDB Cloud Console](https://cockroachlabs.cloud)
    2. Select your cluster
    3. Click the **Connect** button (top right)
    4. Select **Parameters only** to view individual values:

    | Parameter    | Example                                       |
    | ------------ | --------------------------------------------- |
    | **Host**     | `my-cluster.gcp-us-east1.cockroachlabs.cloud` |
    | **Port**     | `26257`                                       |
    | **Database** | `defaultdb`                                   |
    | **Username** | `root`                                        |
    | **Password** | Your database password                        |

    <Note>
      CockroachDB uses port **26257**, not the standard PostgreSQL port `5432`.
    </Note>
  </Step>

  <Step title="Add VexiData to the IP allowlist">
    CockroachDB Cloud blocks all connections by default. You must add VexiData's IP addresses.

    1. Go to your cluster's **Networking** page
    2. Click the **IP Allowlist** tab
    3. Click **Add Network**
    4. Add each of VexiData's IPs:

    | Name     | Network            |
    | -------- | ------------------ |
    | VexiData | `46.101.71.122/32` |

    5. Select **CockroachDB Client** for the access type
    6. Click **Apply**

    <Note>
      IP allowlist configuration is **mandatory**. Your connection will fail without this step.
    </Note>
  </Step>

  <Step title="Add the connection in VexiData">
    1. Go to [Data Sources](https://vexidata.com/data-sources) in VexiData
    2. Click **PostgreSQL** to open the connection form (CockroachDB is PostgreSQL-compatible)
    3. Fill in the details:

    | Field            | Value                                                                       |
    | ---------------- | --------------------------------------------------------------------------- |
    | **Display Name** | A name to identify this connection (e.g., "CockroachDB Production")         |
    | **Host**         | Your cluster hostname (e.g., `my-cluster.gcp-us-east1.cockroachlabs.cloud`) |
    | **Port**         | `26257`                                                                     |
    | **Database**     | `defaultdb` (or your database name)                                         |
    | **Schema**       | `public` (default)                                                          |
    | **Username**     | `root` (or your user)                                                       |
    | **Password**     | Your database password                                                      |
  </Step>

  <Step title="Test and save">
    Click **Test & Save Connection**. VexiData will verify it can reach your database. Once connected, your schema will be analyzed automatically.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection timed out">
    * Verify VexiData's IPs are in your cluster's **IP Allowlist** — CockroachDB blocks all connections by default
    * Make sure you're using port **26257**, not `5432`
    * Check that your cluster is running in the CockroachDB Console
  </Accordion>

  <Accordion title="Authentication failed">
    * Double-check your credentials from the **Connect** dialog in the CockroachDB Console
    * If you've forgotten your password, reset it from the cluster's **SQL Users** page
  </Accordion>

  <Accordion title="No tables visible after connecting">
    * Confirm your tables are in the `public` schema
    * Check the correct database name — CockroachDB uses `defaultdb` by default
  </Accordion>

  <Accordion title="Some queries behave differently than PostgreSQL">
    * CockroachDB is PostgreSQL wire-compatible but not identical. Most standard queries work, but some PostgreSQL-specific features (like certain data types or extensions) may not be supported
  </Accordion>
</AccordionGroup>
