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

# connection

> Commands for managing named connections.

The `connection` command group lets you create, list, update, and delete named connections to data sources.

Connections are stored as encrypted `.conn` files. See [Connection files](../connections.mdx) for details on where they are stored and how they work.

***

## connection list

Lists all saved connections.

```bash theme={null}
cdatacli connection list
```

**Output**

```json theme={null}
[ {
  "name" : "my-salesforce",
  "driver" : "Salesforce",
  "file" : "C:\\Users\\you\\AppData\\Roaming\\CData\\Salesforce Data Provider\\my-salesforce.conn",
  "extension" : ".conn",
  "properties" : {
    "AuthScheme" : "OAuth",
    "InitiateOAuth" : "GETANDREFRESH"
  }
} ]
```

***

## connection create

Creates a new named connection and saves it as an encrypted `.conn` file.

```bash theme={null}
cdatacli connection create --driver <driver-name> --name <connection-name> \
  --connectionstring <connection-string>
```

**Options**

| Option               | Description                                                     | Required |
| -------------------- | --------------------------------------------------------------- | -------- |
| `--driver`           | Name of the CData JDBC driver to use                            | Yes      |
| `--name`             | Name for the connection                                         | Yes      |
| `--connectionstring` | Semicolon-separated connection properties in `Key=Value` format | Yes      |

**Example**

```bash theme={null}
cdatacli connection create --driver "Salesforce" --name "my-salesforce" \
  --connectionstring "User=you@example.com;Password=yourpassword;SecurityToken=yourtoken"
```

To see available connection properties for a driver, use [`drivers connectionprops`](./drivers.mdx#drivers-connectionprops).

***

## connection update

Updates an existing named connection by merging, replacing, or removing connection properties.

```bash theme={null}
cdatacli connection update --name <connection-name> [options]
```

**Options**

| Option               | Description                                                                                                             | Required |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------- |
| `--name`             | Name of the connection to update                                                                                        | Yes      |
| `--connectionstring` | Semicolon-separated connection properties in `Key=Value` format to merge into or replace the existing connection string | No\*     |
| `--replace`          | Replaces the entire existing connection string with the value of `--connectionstring`                                   | No       |
| `--unset`            | Comma-separated list of properties to remove from the connection                                                        | No\*     |
| `--force`            | Skips connection validation after the update                                                                            | No       |
| `--compact`          | Prints JSON output on a single line                                                                                     | No       |

\*At least one of `--connectionstring` or `--unset` is required. `--replace` and `--unset` cannot be used together.

**Examples**

Merge new properties into an existing connection:

```bash theme={null}
cdatacli connection update --name "my-salesforce" \
  --connectionstring "User=newuser@example.com;SecurityToken=newtoken"
```

Replace the entire connection string:

```bash theme={null}
cdatacli connection update --name "my-salesforce" \
  --connectionstring "User=newuser@example.com;Password=newpass;SecurityToken=newtoken" \
  --replace
```

Remove a property from a connection:

```bash theme={null}
cdatacli connection update --name "my-salesforce" --unset "Password"
```

***

## connection delete

Deletes a saved connection.

```bash theme={null}
cdatacli connection delete --name <connection-name>
```

**Options**

| Option   | Description                      | Required |
| -------- | -------------------------------- | -------- |
| `--name` | Name of the connection to delete | Yes      |

**Example**

```bash theme={null}
cdatacli connection delete --name "my-salesforce"
```
