# Database credentials

> Using **Cube Cloud** or your own **Cube Core** deployment instead of Embeddable's built-in Cube? See [Bring your own Cube](https://docs.embeddable.com/data/bring-your-own-cube) — this page does not apply to you.

Under the hood, Embeddable relies on an open-source library called [Cube](https://cube.dev/docs/product/configuration/data-sources) to connect to your database.

Below are the `type` and `credentials` fields you’ll need when [connecting your database](./connect-your-database). You can also set an optional [`concurrency`](./connect-your-database#connection-concurrency) field on the connection itself (alongside `type` and `credentials`, not inside it) to control how many connections Cube opens to your database.

### Athena
[Cube docs](https://cube.dev/docs/product/configuration/data-sources/aws-athena)
```javascript
type: 'athena',
credentials: {
  accessKeyId: '...',
  secretAccessKey: '...',
  region: '...',
  // S3OutputLocation: '...',
  // workGroup: '...',
  // catalog: '...',
  // schema: '...',
}
```

### BigQuery
API collection: https://github.com/embeddable-hq/embeddable-public-apis
[Cube docs](https://cube.dev/docs/product/configuration/data-sources/google-bigquery)
```javascript
type: 'bigquery',
credentials: {
  projectId: '...',
  credentials: { // content of service-account.json
    "type": "service_account",
    "project_id": "...",
    // etc.
  }
}
```

### Clickhouse
[Cube docs](https://cube.dev/docs/config/databases/clickhouse)
```javascript
type: 'clickhouse',
credentials: {
  database: '...',
  host: '...',
  protocol: 'http:',
  username: '...',
  password: '...',
  port: 8443
}
```

### Databricks
[Cube docs](https://cube.dev/docs/product/configuration/data-sources/databricks-jdbc)
```javascript
type: 'databricks-jdbc',
credentials: {
  url: '...',
  token: '...',
}
```

### Druid
[Cube docs](https://cube.dev/docs/config/databases/druid)
```javascript
type: 'druid',
credentials: {
  url: '...',
  user: '...',
  password: '...',
  // database: '...'
}

```
### Elasticsearch
[Cube docs](https://cube.dev/docs/product/configuration/data-sources/elasticsearch)
```javascript
type: 'elasticsearch',
credentials: {
  url: '...',
  // queryFormat: '...',
  // openDistro: '...',
  // ssl: '...',
}
```

### MotherDuck
[Cube docs](https://cube.dev/docs/product/configuration/data-sources/duckdb)
```javascript
type: 'duckdb',
credentials: {
  motherDuckToken: '...'
}
```

### MS SQL / SQL Server
[Cube docs](https://cube.dev/docs/config/databases/mssql)
```javascript
type: 'mssql',
credentials: {
  server: '...',
  port: 1433,
  user: '...',
  password: '...',
  database: '...',
  options: {
    // trustServerCertificate: true
  }
}
```

### MS Azure Fabric / SQL Server
[Cube docs](https://docs.cube.dev/admin/connect-to-data/data-sources/ms-fabric)
```javascript
{
  "type": "msfabric",
  "credentials": {
    "server": "...",
    "database": "...",
    "tenantId": "...",
    "authType": "...", // ActiveDirectoryPassword or ActiveDirectoryServicePrincipal
    "username": "...",
    "password": "...",
    "clientId": "..."
  }
}
```

### MySQL / MariaDB
[Cube docs](https://cube.dev/docs/config/databases/mysql)
```javascript
type: 'mysql',
credentials: {
  database: '...',
  host: '...',
  user: '...',
  password: '...',
  port: 3306,
  ssl: true
}
```

### Postgres
API collection: https://github.com/embeddable-hq/embeddable-public-apis
[Cube docs](https://cube.dev/docs/config/databases/postgres)
```javascript
type: 'postgres',
credentials: {
  database: '...',
  host: '...',
  user: '...',
  password: '...',
  port: 5432,
  ssl: true // or { rejectUnauthorized: false }
}
```

### Redshift
[Cube docs](https://cube.dev/docs/product/configuration/data-sources/aws-redshift)
```javascript
type: 'redshift',
credentials: {
  database: '...',
  host: '...',
  user: '...',
  password: '...',
  port: 5439,
  ssl: true
}
```

### Snowflake
[Cube docs](https://cube.dev/docs/config/databases/snowflake)
```javascript
type: 'snowflake',
credentials: {
  account: '...',
  warehouse: '...',
  database: '...',
  username: '...',
  "authenticator": "SNOWFLAKE_JWT",
  "privateKey": "-----BEGIN PRIVATE KEY-----\n........\n-----END PRIVATE KEY-----"
  // password: '...',
  // role: '...',
  // region: '...',
}
```
To generate a private key:
```
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
```
To extract the public key:
```
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
```

### Trino
[Cube docs](https://cube.dev/docs/config/databases/trino)
```javascript
type: 'trino',
credentials: {
  host: "...",
  port: "...",
  catalog: "...",
  schema: "...",
  user: "...",
  basic_auth: {
    user: "...",
    password: "..."
  },
  ssl: {}
}
```

### More databases
For the full list of **supported databases**, [click here](https://cube.dev/docs/product/configuration/data-sources).

---
Source: https://docs.embeddable.com/data/credentials
