# Connect SAP HANA

Reportworq reaches **SAP HANA** in two supported ways:

- The **SAP HANA** tile (**recommended**). It uses the CData ADO.NET driver that is shipped inside Reportworq, so there is nothing to install on the Reportworq server, it works on Windows, Linux, and Docker, and you do not buy or enter a separate driver license key. It supports SAP HANA 2.0 SPS 04 or later, both HANA Cloud and on-premises systems. The first part of this page walks through it.
- A native **ODBC** connection through the generic **ODBC Provider** tile, using SAP's own HANA Client driver. Choose it when you must use SAP's driver or need a sign-in method the shipped driver does not offer. See [Connect through ODBC instead](#connect-through-odbc-instead).

Both routes query SAP HANA through table or SQL mode in a data model, exactly like any other datasource. To decide between them, see [Which one should I use](#which-one-should-i-use).

## Before you begin

- You are an administrator, working in **Settings** > **Integrations**. See [Connect a data source](https://docs.reportworq.com/ai-integrations-guide/20-data-sources/connect-a-data-source.md) for the general add-and-test flow.
- The SAP HANA system is reachable from the **Reportworq server**, not only from your workstation. Check the firewall and the port first.
- You have a HANA database user for Reportworq. A dedicated user with `SELECT` on the schemas and views you report from is the safest choice. Calculation views appear as views.
- **HANA Cloud only:** the instance must allow connections from the Reportworq server. Add the server's public IP address to the instance's allowed connections in SAP HANA Cloud Central.

## Connect with the SAP HANA tile

1. Go to **Settings** > **Integrations**.
2. Select **Add integration**, find **SAP HANA** in the catalog, and select its tile.
3. **Enable Integration** is unchecked on a new SAP HANA integration, so select it, then enter a unique **Display name** for the connection.
4. Fill in the connection fields. The basic view shows them in this order:

   | Field | What to enter |
   |---|---|
   | **Server** | The name or network address of the SAP HANA database instance. |
   | **Port** | The port of the server hosting the database. It defaults to **39013**. For HANA Cloud, enter **443**. For an on-premises system, enter the port your HANA administrator gives you. |
   | **Auth Scheme** | The sign-in method, a dropdown. Leave it at **Password** for a HANA user and password. See [Sign in with Okta](#sign-in-with-okta). |
   | **User** and **Password** | The HANA database user and its password. |
   | **Database** | The database to connect to. |
   | **Schema** | The HANA schema to work in. Leave it blank unless you need one. |
   | **Include System Objects** | A checkbox. Select it to include HANA's system objects in the list of tables and views. |
   | **Use SSL** | A checkbox. Select it for HANA Cloud. |

   ![The SAP HANA editor in Settings, Integrations, with Enable Integration selected, the Server, Port 443, Auth Scheme Password, User, Password (shown as dots), Database, Schema, Include System Objects and Use SSL fields, and a Connection Test dialog reading Success.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-field-editor.png)

5. Set **Browsable Schemas** (see [Limit the schemas Reportworq lists](#limit-the-schemas-reportworq-lists)), then select **Save Changes** and **Test Connection**. This form has no validation query to fill in. A **Connection Test** dialog reading **Success** means Reportworq reached the system and signed in.
6. Query the source in a data model. See [Query SAP HANA in a data model](#query-sap-hana-in-a-data-model).

### HANA Cloud

Set **Server** to the host name of the instance's SQL endpoint, **Port** to **443** (not the 39013 default), and select **Use SSL**. Make sure the instance's allowed connections include the public IP address of the Reportworq server, or the connection is refused before it reaches the sign-in.

A SAP Datasphere space's database user connects the same way: create a database user for the space (**Space Management**, **Database Access**, **Database Users**, then **Enable Read Access (SQL)**), and use its user name, which has the form `SPACE#SUFFIX`, with port **443** and **Use SSL** selected. The Datasphere system's IP allowlist must include the Reportworq server's public outbound IP address, or the handshake is refused (see [Troubleshooting](#troubleshooting)).

### On-premises HANA

Set **Server** to the host name or address of the HANA system and **Port** to the SQL port of the database you are connecting to, replacing the 39013 default if yours differs. Ask your SAP HANA administrator to confirm the port for your system.

### Sign in with Okta

The **Auth Scheme** dropdown offers **Password**, **OKTA**, and **Kerberos**.

![The Auth Scheme dropdown open on the SAP HANA editor, listing Password, OKTA, and Kerberos.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-auth-scheme-options.png)

To sign in through Okta, choose **OKTA**, enter the Okta **User** and **Password**, and select **Show Advanced Options** to set **SSO Properties** (in the **SSO** group) with at least `SSOLoginUrl`, the login URL of your Okta organization. When Okta requires multi-factor authentication, the driver also takes an `MFAType` (one of `OKTAVerify`, `Email`, or `SMS`) and, for the code sent to the user's device, the one-time code in the SSO properties. For the exact property syntax, see the [CData SAP HANA documentation](https://cdn.cdata.com/help/SNN/ado).

**Kerberos** is also listed. It is configured in the **Kerberos** group of the advanced options; see the CData documentation for its properties. Reportworq has not tested it.

### Limit the schemas Reportworq lists

On HANA Cloud, the unfiltered table list includes the schemas SAP delivers: the `PUBLIC` schema alone holds about 578 tables, and the `PAL_*` and `SAP_PA_APL*` schemas add more. To list only your own, select **Show Advanced Options** and set **Browsable Schemas** (in the **Schema** group) to your schema or schemas, for example `RW_DEMO`.

![The SAP HANA editor with Show Advanced Options selected, scrolled to the SSH, Firewall, Logging, and Schema groups, with Browsable Schemas set to RW_DEMO.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-advanced-options.png)

### Advanced options

Select **Show Advanced Options** to reveal the driver's other connection properties, grouped as **Authentication**, **SSO**, **OAuth**, **Kerberos**, **SSL**, **SSH**, **Firewall**, **Logging**, **Schema**, **Miscellaneous**, and **Other**. Besides **Browsable Schemas** above, those most often needed for SAP HANA:

- The **Firewall** group (`FirewallType`, `FirewallServer`, `FirewallPort`, `FirewallUser`, `FirewallPassword`) routes the connection through a proxy or firewall.
- The **SSH** group (`UseSSH`, `SSHServer`, `SSHPort`, `SSHUser`, `SSHPassword`, and related) tunnels the connection through an SSH server.

For the full property reference, open the [CData SAP HANA ADO.NET documentation](https://cdn.cdata.com/help/SNN/ado). It is the authority for every property and the available sign-in methods.

## Query SAP HANA in a data model

In a data model, add the SAP HANA connection as its source. Its tables are listed under their schema and can be searched. With **Browsable Schemas** set to `RW_DEMO`, the list shows only that schema's tables.

![The Tables tab of a data model on the SAP HANA connection, listing only REGIONAL_SALES with a Search tables box.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-table-list.png)

Build a view in one of two ways, as for any SQL connector (see [Query the source in a data model](https://docs.reportworq.com/ai-integrations-guide/20-data-sources/connect-sql-and-databases.md#query-the-source-in-a-data-model)):

- On the view's **Design** tab, pick a table and tick the columns you want.

  ![The data model designer on a REGIONAL_SALES view with five fields ticked from one table.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-view-designer.png)

- Write the view as SQL only.

  ![The Preview tab of a SQL-only view on SAP HANA, showing revenue by region in four rows.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-sql-preview.png)

The **Preview** tab shows rows from HANA. A row-capped preview works on this tile with no Limit setting to configure.

![The Preview tab of the REGIONAL_SALES view, showing fiscal period, region, product line, revenue, and units, with the 100 rows selector.](https://docs.reportworq.com/assets/screenshots/data/sap-hana-table-preview.png)

## Connect through ODBC instead

You can instead connect through the generic **ODBC Provider** tile with SAP's own HANA Client driver. This is a supported alternative, not a temporary measure, and it has been tested on a Windows Reportworq server against SAP HANA Cloud with SAP HANA Client ODBC driver 2.30.27. For the general ODBC Provider editor, credential variables, and the Windows and Linux notes, see [Connect SQL Server, OLE DB, and ODBC](https://docs.reportworq.com/ai-integrations-guide/20-data-sources/connect-sql-and-databases.md).

1. **Install the 64-bit SAP HANA Client** (the HDBODBC driver) on **every Reportworq host**. The Reportworq service is a 64-bit process, so a 32-bit driver is invisible to it, and the driver must be visible to the service account, not only to your own login.
2. **Optional: create a DSN.** A DSN lets you prove the driver and credentials outside Reportworq first. Open **ODBC Data Sources (64-bit)**, go to the **System DSN** tab, select **Add**, and choose **HDBODBC**. SAP's **ODBC Configuration for SAP HANA** dialog asks for a **Data source name**, a **Description**, a **Database type** (choose **SAP HANA Cloud** for HANA Cloud), and the **Server** under **Host**, entered as `<host>:443` for HANA Cloud. Select **Test connection...** in that dialog to check it. The DSN alone is not enough for HANA Cloud: you still need the encryption keywords in step 4.
3. In **Settings** > **Integrations**, select **Add integration** and choose the **ODBC Provider** tile.
4. Enter a **Connection String**. Use `%USERNAME%` and `%PASSWORD%` as placeholders and put the real values in the tile's masked **`%USERNAME%` Variable** and **`%PASSWORD%` Variable** fields, so the secrets never appear in the saved string.

   For an on-premises system:

   ```
   Driver={HDBODBC};ServerNode=<host>:<port>;UID=%USERNAME%;PWD=%PASSWORD%;
   ```

   For HANA Cloud on a Windows server, with port **443**, both of these forms need the encryption keywords. Use a DSN:

   ```
   DSN=<YourHanaDSN>;UID=%USERNAME%;PWD=%PASSWORD%;encrypt=TRUE;sslValidateCertificate=TRUE;sslCryptoProvider=mscrypto;
   ```

   or no DSN:

   ```
   Driver={HDBODBC};ServerNode=<host>:443;UID=%USERNAME%;PWD=%PASSWORD%;encrypt=TRUE;sslValidateCertificate=TRUE;sslCryptoProvider=mscrypto;
   ```

   `encrypt=TRUE` is required because HANA Cloud accepts only encrypted connections. `sslCryptoProvider=mscrypto` is the Windows setting: it makes the driver use the Windows certificate store. What a Linux server needs here has not been tested. Confirm the exact `Driver={...}` name on the **Drivers** tab of the 64-bit `odbcad32.exe`, and use it as listed there.
5. Open **Advanced Options** and set **Validation Query** to `SELECT 1 FROM DUMMY`. A bare `SELECT 1` is not valid on SAP HANA, so do not leave the default or use it. Set **Limit Query Type** to **Limit**.
6. Save and select **Test Connection**, which should report success. Then query the source in a data model as above.

**Linux and Docker.** On a Linux server the ODBC route needs **unixODBC** plus SAP's Linux client, registered in `/etc/odbcinst.ini`. The tarball or VM install can add them with the system package manager and SAP's installer. The Reportworq Docker image ships neither, so a container deployment needs a derived image that adds them. This is the main practical difference from the SAP HANA tile, which needs nothing added.

## Which one should I use

| | SAP HANA tile (CData) | ODBC Provider with SAP's driver |
|---|---|---|
| Installed on the Reportworq server | Nothing. The driver ships with Reportworq. | SAP HANA Client (64-bit) on every host. |
| Windows | Yes | Yes |
| Linux | Yes | Yes, with unixODBC and SAP's Linux client. |
| Docker | Yes | Only with a derived image that adds the driver. |
| Setup effort | Fill in named properties. | Install a driver, then write a connection string or DSN. |
| Driver support | The CData driver, which Reportworq ships. | SAP's own driver, supported by SAP. |

Use the **SAP HANA tile** unless you have a reason not to. Use **ODBC** when your organization requires SAP's own driver, or when you need a sign-in method the shipped driver does not offer. This page describes password and Okta sign-in for the tile. If you need another method, such as X.509 certificates, SAML sign-in to HANA, or keys stored with SAP's `hdbuserstore`, check the [CData SAP HANA documentation](https://cdn.cdata.com/help/SNN/ado) for whether the driver supports it, and otherwise use ODBC with SAP's driver.

## Troubleshooting

| Symptom | Likely cause | Fix |
|---|---|---|
| Connection refused, a timeout, or "Remote host disconnected during SSL negotiation" | The port is wrong, a firewall blocks it from the Reportworq server, or (HANA Cloud and SAP Datasphere) the IP allowlist does not include the server. An allowlist refusal looks like "Remote host disconnected during SSL negotiation", because the handshake is dropped before sign-in. | Confirm the SQL port with the HANA administrator and test the address from the Reportworq server itself. For HANA Cloud, add the server's public outbound IP address to the instance's allowed connections in HANA Cloud Central. In SAP Datasphere, add it under **System**, **Configuration**, **IP Allowlist**, **Trusted IPs**. |
| An SSL or certificate error | **Use SSL** is not selected for HANA Cloud, or (ODBC) the connection string lacks `encrypt=TRUE`. On a Linux server, the CData driver's own TLS stack can also reject a certificate chain that the operating system trusts, and Reportworq does not work around this for SAP HANA. | Select **Use SSL** and set the port to **443** for HANA Cloud (or add `encrypt=TRUE;sslValidateCertificate=TRUE;` on ODBC). If a Linux server still reports "Server certificate verification failed", use the ODBC route. |
| The connection tests but no tables appear | The HANA user lacks `SELECT` on the schemas, or **Browsable Schemas** excludes them, or system objects are what you are looking for. | Grant the user `SELECT` on the schemas or views, check **Browsable Schemas**, and select **Include System Objects** if you need system objects. After a change at the source, run the **Refresh driver metadata** tool on the connection. |
| **ODBC**: "-10709 Connection failed (RTE:[1000013] Invalid flags specified)" | The connection did not request encryption, and HANA Cloud accepts only encrypted connections. | Add `encrypt=TRUE;` to the connection string. |
| **ODBC**: "-10709 Connection failed (RTE:[300012] Cannot create SSL engine: No valid certificate specified)" | The driver cannot find its certificate store. | On a Windows server, add `sslCryptoProvider=mscrypto;` so the driver uses the Windows certificate store. Do not turn certificate validation off to get past it. |
| **ODBC**: "Data source name not found and no default driver specified" | The `Driver={...}` name does not match an installed driver, the SAP HANA Client is not installed on that host, it is the 32-bit build, the DSN is a User DSN, or on Linux the driver is not registered in `/etc/odbcinst.ini`. | Install the 64-bit SAP HANA Client on every Reportworq host, copy the driver name exactly from the **Drivers** tab of the 64-bit `odbcad32.exe` (or from `odbcinst.ini`), and create any DSN on the **System DSN** tab. |
| A row-limited preview fails with a syntax error (ODBC) | **Limit Query Type** is not **Limit**. | Set **Limit Query Type** to **Limit**. |

## Notes and limits

- Only administrators can add or configure datasource connectors.
- The driver, any DSN, and the SAP HANA Client all live on the Reportworq **server**, not on your workstation.
- For the shared CData add-and-test flow, see [Connect CData sources](https://docs.reportworq.com/ai-integrations-guide/20-data-sources/connect-cdata-sources.md). For every connector Reportworq ships, see the [Connector catalog](https://docs.reportworq.com/ai-integrations-guide/20-data-sources/connector-catalog.md).

Source: https://docs.reportworq.com/ai-integrations-guide/20-data-sources/connect-sap-hana.html
