Skip to main content

Connect to SAP HANA

SAP HANA is an in-memory relational database platform. You can create a SAP HANA resource to connect to your database and build apps and automations that use SQL to read and write data.

What you can do with SAP HANA in Retool

After you create a SAP HANA resource in Retool, you can:

  • Query data with SQL, including joins, aggregations, subqueries, and SAP HANA-specific functions.
  • Insert, update, and delete records with SQL statements.
  • Run scheduled SAP HANA queries in Retool workflows.
  • Build dashboards and apps that display SAP HANA query results in charts, tables, and other components.
  • Give Retool Agents typed, structured access to SAP HANA queries as custom tools.

Before you begin

To connect SAP HANA to Retool, you need the following:

  • SAP HANA instance: An accessible SAP HANA database.
  • Network access: Your SAP HANA instance must permit connections from Retool's IP addresses.
  • Credentials: A connection string with any credentials your database requires.
  • Retool permissions: Ability to create and manage resources in your organization.

Create a SAP HANA resource

Follow these steps to create a SAP HANA resource in your Retool organization.

Create a new resource

In your Retool organization, navigate to Resources in the main navigation and click Create newResource. Search for SAP HANA and click the SAP HANA tile to begin configuration.

SAP HANA resource configuration form.

Configure general settings

Specify a name and description for the resource that indicates which database it connects to. The description provides more context to users and Assist about how to use the resource.

Example nameExample description
Analytics HANAThe production SAP HANA database used for analytics reporting.
Sales HANA (read-only)A read-only SAP HANA database containing sales transaction data.

Configure resource credentials

Configure the connection settings for your SAP HANA resource.

Connection string

Provide a JDBC connection string that includes your SAP HANA instance's host, port, and credentials.

Example
jdbc:sap://host:port/?user=test&password=secure

Configure advanced options

Configure optional settings available under the Advanced options section of the resource configuration form.

Disable converting queries to prepared statements

By default, Retool uses prepared statements for SAP HANA queries, which improves performance and prevents SQL injection. Disable this option only if your SAP HANA setup does not support prepared statements.

SSH tunnel

If your SAP HANA instance is not publicly accessible, configure an SSH tunnel to connect through a bastion host. Provide SSH host, port, username, and authentication method (password or private key).

Outbound region

If your organization uses outbound regions, select the region that should be used for requests to SAP HANA. This controls which geographic region your requests originate from.

Test the connection

Click Test connection to verify Retool can connect to your SAP HANA instance. If the test succeeds, you see a success message. If it fails, check the following:

  • Network access: Ensure your SAP HANA instance accepts connections from Retool's IP addresses or your self-hosted instance's network.
  • Connection string: Verify the host, port, and credentials in your connection string are correct.
  • SSH tunnel: If you configured an SSH tunnel, verify the bastion host is reachable and the tunnel credentials are correct.
Best practice

After testing the connection, click View in console to open the Debug Tools console. The console displays detailed information about the test, including the test query executed, execution time, and error details if the test fails.

Save the resource

Click Create resource to save your SAP HANA resource. You can now use it in queries across your Retool apps and automations.

Interact with SAP HANA data

Once you've created a SAP HANA resource, you can interact with SAP HANA data using Retool.

Caution

SAP HANA isn't yet supported in the new app builder. Use a classic app, workflow, or agent instead.

For classic apps, workflows, and agents, refer to the SQL queries documentation to learn how to write a resource query.

Best practices

Follow these best practices to maintain the security of your SAP HANA resource.

  • Store credentials securely: Retool encrypts your SAP HANA connection string automatically, so you don't need to route it through a separate secrets store.
  • Use a read-only user for read-heavy resources: Create a dedicated database user with only the permissions a resource actually needs, and use a read-only user for resources that only query data.
  • Use an SSH tunnel for private databases: Keep your SAP HANA instance off the public internet and connect through an SSH tunnel instead.
  • Use resource environments: Organizations on an Enterprise plan can configure multiple resource environments to maintain separate SAP HANA credentials for production, staging, and development.