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

# CockroachDB

> Stream data into CockroachDB

## Prerequisites

* A database user with sufficient privileges to create users

## CockroachDB Setup

### 1. Grant Database Access

In the left hand navigation menu, open **Networking** under **Security**.

Add the appropriate IP address from [Streamkap IP Addresses](/streamkap-ip-addresses).

### 2. Create Database User

It's recommended to create a separate user for Streamkap to access your CockroachDB database.

#### Create user via SQL Shell

In the left hand navigation menu, open SQL Shell.

Switch to the database you will be sending data to or create a new database.

Run the script below replacing items in `{}` with the appropriate values.

```SQL SQL theme={null}
-- Create User
CREATE USER streamkap_user WITH PASSWORD {'password'};
```

#### Create user via Cloud

In the left hand navigation menu, open SQL users under **Security**.

Input `streamkap_user` and generate a password.

### 2. Connection Settings

* **Name**: Enter a name for your connector.
* **Hostname**: Specify the hostname.
* **Port**: Default is `26257`.
* **Database**: Name of the database to use.
* **Username**: Username to access the database. By default, Streamkap scripts use `streamkap_user`.
* **Password**: Password to access the database.

### 3. Ingestion Settings

* **Schema**: The target schema where tables should be created.
* **Schema evolution mode**: Controls how schema evolution is handled by the sink connector.

<Info>
  **Self-managed schema evolution**

  If you have created the destination tables and want to manage their schemas instead of the connector, set **Schema evolution mode** to `none`.
</Info>

See [Ingestion Modes](/insertsupserts) for detailed information about insert modes, primary key modes, and delete handling.

* **Insert mode**: Specifies the strategy used to insert events into the database.
* **Delete mode**: Specifies whether the connector processes DELETE or tombstone events and removes the corresponding row from the database.
* **Primary key mode**: Specifies how the connector resolves the primary key columns from the event.
  * **Custom primary key**: Optional. Either the name of the primary key column or a comma-separated list of fields to derive the primary key from.
* **Tasks**: The maximum number of active tasks. This controls the amount of parallelism in writing events.

Click **Save**.
