Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
In this blog post, we continue with the Spring Boot application that we developed in PART 1We will now look at the steps involved in binding a HANA instance with our application.

STEP 2 : Create HANA service instance.

We will create the HANA service instance in this step. HANA service provisions a HANA DB for us. This is a paid service so you'll need to enable it using ISM tool.

For this exercise, we will use the 64standard service plan.

Navigate to Service Marketplace of your CF space and select SAP HANA Service -

Create New instance of this service as follows -

Provide 15 characters long password.

You can skip the next step, as the binding is not really required. Confirm the creation of service by giving it a name - haas.

STEP 3 : Create SAP HANA Schema and HDI Container service instance.

Now that we have provisioned a HANA DB for us, it is time to create an instance of HANA Schema and HDI Service. This service generates a schema (if you use schema plan) which allows your Spring Boot application to create its database artifacts. There are other plans ofcourse which cater to different use-cases. For example, if you follow the Cloud Application Programming model, it is recommended to model the database artifacts in CDS. In that case, hdi-shared plan is used, which deploys the database artifacts from your CDS files.

However, in this exercise we will make use of the schema plan, as our database tables are defined in the application layer itself.

Navigate to Cloud Foundry space and create an instance of SAP HANA Schema and HDI Container service as follows -

You can leave the application binding for now as the binding will take place during application deployment. We will name the instance as hana_migration.

STEP 3 : Assign Roles and permissions for the HDI user.

Now that you have created a HDI schema service, it would have generated an database user for you. We need to assign roles and permissions to this user so that our application can use this user to create the database artifacts.

We will use the CF CLI Tool. Documentation for the usage of this tool can be found here - CLI Documentation.

Let us create a service key for the hana_migration service instance.
cf csk hana_migration hanaKey
cf service-key hana_migration hanaKey

This will generate service key as follows -
"certificate": "-----BEGIN CERTIFICATE-----",
"driver": "",
"host": "zeus.hana...",
"password": "...",
"port": "2...",
"schema": "U...",
"url": "jdbc:sap://...",
"user": "U..."

We will grant Roles and Permission to this user.


3.1 Open the dashboard for the HANA Service instance.

Open the dashboard for the HANA service instance that we created earlier -

3.2 Open HANA Cockpit

The HANA Cockpit opens up with the SYSTEM user that we created while instantiating an instance of SAP HANA Service.Navigate to Role Management and assign the following roles to the user (found int the service key above) -

And finally, we need to grant the package privilege to the user. Navigate to Privilege Assignment -

For System Privileges grant all the privilege -


For Package Privilege assign the following privilege -


With this we have everything in place to deploy the application.  In the next and final part of the blog series, we will deploy our application to Cloud Foundry and check the contents of the database.

See you in next part.



Find the remaining parts here -

  1. Develop the Spring Boot Application (PART 1) - Develop a Spring Boot (Java) application with HANA database on SAP Cloud Platform (Cloud Foundry) - ...

  2. Create instance of HANA service (PART 2) - Develop a Spring Boot (Java) application with HANA database on SAP Cloud Platform (Cloud Foundry) - ...

  3. Deploy and Test (PART 3) - Develop a Spring Boot (Java) application with HANA database on SAP Cloud Platform (Cloud Foundry) – ...