# Exasol

## Setup

The following credentials keys are accepted:

* `host` **(required)** -> The hostname / ip of the instance
* `user` **(required)** -> The username to access the instance
* `password` **(required)** -> The password to access the instance
* `port` (optional) -> The port of the instance. Default is `8563`.
* `schema` (optional) -> The default schema to use
* `ssh_tunnel` (optional) -> The URL of the SSH server you would like to use as a tunnel (example `ssh://user:password@db.host:22`)
* `ssh_private_key` (optional) -> The private key to use to access a SSH server (raw string or path to file).
* `ssh_passphrase` (optional) -> The passphrase to use to access a SSH server.

### Additional Connection Parameters

* `validate_server_certificate` (optional) -> Whether to validate the server certificate. Default is `true`.
* `encryption` (optional) -> Whether to use encryption for the connection. Default is `true`.
* `compression` (optional) -> Whether to use compression for the connection. Default is `false`.
* `fetch_size` (optional) -> Number of rows to fetch at once in KiB. Default is `2000`.
* `autocommit` (optional) -> Auto-commit mode. Default is `false` (enabled).
* `client_name` (optional) -> Name of the client application. Default is `"Go client"`.
* `client_version` (optional) -> Version of the client application.
* `certificate_fingerprint` (optional) -> Expected SHA256 checksum of the server's TLS certificate in Hex format.
* `query_timeout` (optional) -> Query timeout in seconds. Default is `0` (no timeout).
* `resultset_max_rows` (optional) -> Maximum number of rows in result set. Default is `0` (no limit).

### Using `sling conns`

Here are examples of setting a connection named `EXASOL`. We must provide the `type=exasol` property:

{% code overflow="wrap" %}

```bash
$ sling conns set EXASOL type=exasol host=<host> user=<user> password=<password> port=<port> schema=<schema>

# With additional parameters
$ sling conns set EXASOL type=exasol host=<host> user=<user> password=<password> validate_server_certificate=true encryption=true

# OR use url
$ sling conns set EXASOL url="exasol://myuser:mypass@host.ip:8563/myschema?validate_server_certificate=true&encryption=true"
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/sling-cli/environment#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export EXASOL='exasol://myuser:mypass@host.ip:8563/myschema?validate_server_certificate=true'
export EXASOL='{ type: exasol, user: "myuser", password: "mypass", host: "host.ip", port: 8563, schema: "myschema", validate_server_certificate: true }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/sling-cli/environment#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  EXASOL:
    type: exasol
    host: <host>
    user: <user>
    password: <password>
    port: <port>
    schema: <schema>
    validate_server_certificate: true
    encryption: true
    autocommit: false
    fetch_size: 2000
    query_timeout: 60

  EXASOL_URL:
    url: "exasol://myuser:mypass@host.ip:8563/myschema?validate_server_certificate=true&encryption=true"
```

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).
