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

# Tutorial: MariaDB over Live JDBC

> Query the UCSC Genome Browser, a real public database, end to end — including the one TLS gotcha

This tutorial runs real queries against the **UCSC Genome Browser** public database (MySQL-protocol, served through the MariaDB driver). It is officially public with published credentials, so you can reproduce every call here exactly — RWS QA runs these very queries against the deployed service.

| | |
| - | - |
| Engine | MariaDB 10.11 (MariaDB JDBC driver) |
| JDBC URL | `jdbc:mariadb://genome-mysql.soe.ucsc.edu:3306/hg38?sslMode=disable` |
| User | `genome` |
| Password | none |

## Prerequisites

* The `RWS Connect Live JDBC` connection from the [Live JDBC reference](https://docs.rwsintegration.com/en/features/connections/databases.md), with your `x-api-key`
* `x_db_password` always names a stored credential — for a passwordless public user, RWS stores an **empty** credential once (e.g. `PUBLIC_NO_PASSWORD`); email [connect@rwsintegration.com](mailto:connect@rwsintegration.com)

## The one gotcha first: `sslMode=disable`

The MariaDB driver asks for TLS by default. UCSC's server doesn't offer it, so without the property the call fails with `502 db_unreachable` and the driver's message *"Trying to connect with ssl, but ssl not enabled in the server"*. The fix is one connection property, allowed by the URL rules:

```
jdbc:mariadb://genome-mysql.soe.ucsc.edu:3306/hg38?sslMode=disable
```

This applies to any MariaDB-driver server without TLS — recognize the error, add the property.

## Step 1: A first unpaged query

Count the sequences of the human genome assembly `hg38`:

| Parameter | Value |
| - | - |
| `x_jdbc_url` | `jdbc:mariadb://genome-mysql.soe.ucsc.edu:3306/hg38?sslMode=disable` |
| `x_db_user` | `genome` |
| `x_db_password` | `PUBLIC_NO_PASSWORD` |
| `x_sql` | `SELECT VERSION() AS version, COUNT(*) AS chromosomes FROM chromInfo` |

```bash theme={null}
curl -G "https://connect.rwsintegration.com/v1/live/jdbc" \
  -H "x-api-key: $RWS_CONNECT_API_KEY" \
  --data-urlencode "x_jdbc_url=jdbc:mariadb://genome-mysql.soe.ucsc.edu:3306/hg38?sslMode=disable" \
  --data-urlencode "x_db_user=genome" \
  --data-urlencode "x_db_password=PUBLIC_NO_PASSWORD" \
  --data-urlencode "x_sql=SELECT VERSION() AS version, COUNT(*) AS chromosomes FROM chromInfo"
```

```json theme={null}
{ "items": [ { "version": "10.11.8-MariaDB", "chromosomes": "711" } ] }
```

## Step 2: Paginate with a cursor

Page through all 711 sequences, 200 at a time. `chrom` is unique in `chromInfo` — the unique key paging needs:

| Parameter | Value |
| - | - |
| `x_sql` | `SELECT chrom, size FROM chromInfo` |
| `x_pagination` | `cursor` |
| `x_unique_keys` | `chrom` |
| `x_page_size` | `200` |

The first call carries no `x_cursor`; each response's `next_cursor` feeds the next call, until it comes back `null`. In the RWS Application, the cursor pagination config from the [Live JDBC reference](https://docs.rwsintegration.com/en/features/connections/databases.md#pagination) drives the loop for you.

Verified result on the live service: **711 rows in 4 pages of up to 200 — 711 distinct names, no duplicates, no gaps** (offset mode returns the identical set). The `size` column is a `BIGINT` and arrives as a plain decimal string.

## MariaDB notes

* The MariaDB driver also speaks to MySQL-protocol servers — UCSC runs genuine MariaDB 10.11, but the same `jdbc:mariadb:` prefix serves compatible servers.
* Paginated queries run as a derived table with `LIMIT ... OFFSET` or a keyset `WHERE` — any valid `SELECT` without its own `ORDER BY` works.
* Plain connection properties like `sslMode` pass the URL rules; properties that would make the driver load code or read files are refused.

## Next steps

> [card] [Live JDBC guide](https://docs.rwsintegration.com/en/features/connections/databases.md)
>
> The full reference: directives, pagination, errors

> [card] [PostgreSQL tutorial](https://docs.rwsintegration.com/en/features/connections/jdbc/postgresql.md)
>
> The same flow against RNAcentral


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.