How to Connect to SAP HANA in Mule 4

Prathamesh Kulkarni
Another Integration Blog
2 min readAug 8, 2022

This article demonstrates how to establish connectivity to SAP HANA. It will cover what is needed to connect to an SAP instance, including the use of a database connector.

In my last article, “Read SAP Tables With RFC_READ_TABLE in Mule 4 Using SAP Connector”, I compared writing the XML to retrieve the data from RFC_READ_TABLE to writing SQL queries. Many developers struggle to write DataWeave, so I suggest SAP HANA as an alternative, as most developers knows how to write SQL queries.

What is SAP HANA?

SAP HANA provides a driver that enables Java applications to connect to the SAP HANA database with the JDBC application programming interface (API).

To connect to SAP HANA, some dependencies of SAP JDBC are required (which you can find here).

<dependency>

<groupId>com.sap.cloud.db.jdbc</groupId>

<artifactId>ngdbc</artifactId>

<version>2.12.9</version>

<type>pom</type>

</dependency>

To configure SAP HANA, I use the generic connection. To do this, we need four things:

  1. URL of the SAP HANA instance
  2. Driver class name: com.sap.db.jdbc.Driver
  3. Username
  4. Password

Please see the screenshots below, for reference.

Once you have finished configuring the credentials, it is time to test the connection.

The results depicted below indicate a successful test connection.

Next, drag the selection operation module from the Mule palette.

Here, I am calling an SAP table using the where clause. The result will be the same as the database select operation.

Now, the question arises: why are we using SAP HANA instead of RFC_READ_TABLE given by the SAP connector?

SAP HANA allows us to write SQL queries, for which syntax can easily be found anywhere online. Compared to SAP Connectors, it is easier to join multiple tables on the basis of some conditions, with the help of SQL queries.

In conclusion, this article demonstrates how to connect to SAP HANA with the help of a database connector.

--

--