In this blogpost . I would like to provide guidance on how to access HANA Cloud Database & HDI Container in your BTP.
If your BTP account already has HANA Cloud setup & your application (space) in sub-account already has Hana HDI container then you can directly jump to section “Get Started with the SAP HANA Database Explorer” in this blog post”.
Introduction
SAP HANA Cloud is a SAP HANA Cloud is a database as a service (DBaaS) , provides a single place to access, store, and process all enterprise data in real time with high availability .You can develop smart applications with embedded machine learning , analytics (advanced data processing capabilities , insights ) ,document store . SAP HANA Cloud provides all of the advanced SAP HANA technologies for multi-model data processing ,store and access data in-memory and column-based [ it Process mission-critical data at proven in-memory speed] or on disk . By combining in-memory storage with columnar store, data operations are performed faster than in a traditional database with a disk-based storage. Using SAP HANA Cloud, you can set up and manage SAP HANA databases and bind them to applications running on SAP Business Technology Platform (SAP BTP) or elsewhere. You can benefit from cloud qualities such as availability, security, automatic software updates, elasticity, and low total cost of ownership by using SAP HANA Cloud either as a stand-alone solution or as an extension to your existing on-premise environment.
Prerequisites
If you already have an SAP HANA Cloud service in your BTP then skip this step i.e. continue with Use your BTP Existing SAP HANA Cloud service instance and go to section “Get Started with the SAP HANA Database Explorer” in this blog post.
If you need to create an SAP HANA Cloud service instance first → continue with Create an SAP HANA Cloud service instance.
1) Create SAP HANA Cloud service in your BTP
SAP HANA Cloud instances are not created automatically for any type of BTP account. Therefore, you will have to create an SAP HANA Cloud service instance first, if you don’t have one yet.
How to create SAP HANA Cloud instance in the trial BTP environment.
Refer below document ,
On BTP trial, your SAP HANA Cloud instance will be automatically
stopped overnight, according to the server region time zone.
That means you need to restart your instance every day
before you start working with your trial.
Once you complete the tutorial steps in Provision an Instance of SAP HANA Cloud, SAP HANA Database
- Set Up Your SAP HANA Cloud, SAP HANA Database (free tier model or trial) and Understand the Basics
- Take Your First Steps with SAP HANA Cloud, SAP HANA Database
As an optional step if you are completely new to the SAP HANA Cloud environment, you might want to consider also going through this tutorial: Tools to Manage and Access the SAP HANA Cloud, SAP HANA Database in order to familiarize yourself with the various tools that can be used to manage and develop with SAP HANA Cloud.
2) HDI
After provisioning a HANA Cloud DB next step is 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 for different use-cases. For example, if you follow the SAP CAP (SAP Cloud Application Programming Model) is a framework developed by SAP to build cloud applications, services based on either JavaScript/Node.js or Java (Spring Boot). Core Data Services (CDS), which in turn generated into a database objects (tables , views..) & with only few lines of code you have a Web API (OData/REST) which offers functionality to create, read, Query, update ,delete (CRUD+ Q) transactions …In SAP CAP, hdi-shared plan is used, which deploys the database artifacts from your CDS files.All these database artifacts are clubbed into a wrapper called Schema, staged, built and then deployed into SAP HANA Cloud Database in the form of a database container.
In an SAP HANA Cloud instance, the SAP HDI is enabled by default.
So the SAP HANA Deployment Infrastructure (HDI) is a service layer of the SAP HANA database and helps create runtime database objects [e.g., Tables, Views, Procedures, etc] from design-time artifacts like CDS, JPA Entities.
HDI creates a new HANA repository (with both design time and runtime management) per project. Each Container gets its own unique technical user to control database artifacts.
You have two options to create HDI Instance. Manual or Automatic (program)
1) Manually :
You can use BTP Cockpit : Set Up a HANA Schema or an HDI Container
or Commands (CLI)
create-service hana-cloud-trial hdi-shared sap-demo-hdi-db
2) Programming : You can use SAP CAP Framework or Java or NodeJS or Python
- name: sap-demo-hdi-db
type: com.sap.xs.hdi-container
parameters:
service: hana-cloud-trial # 'hana-cloud-trial' 'hanatrial' on BTP trial landscapes
#for BTP enterprise account please use 'hana'
Fo your reference :
Tutorials :
Develop a CAP Node.js App Using SAP Business Application Studio
Build a Business Application Using CAP for Java
Sample apps:
https://github.com/SAP-samples/cloud-cap-samples
https://github.com/SAP-samples/cloud-cap-samples-java
https://github.com/SAP-samples/cap-sflight
Official Document :
In case you’ve a question, find a bug, or otherwise need support, use our community
Now , it is time to learn how to access HANA Cloud Database in your BTP Cockpit.
Get Started with the SAP HANA Database Explorer Cockpit
SAP HANA Database Explorer is a tool used to interact with SAP HANA databases, as well as use the SAP Graph and Spatial engines. In the HANA Database Explorer, you can also access the SQL console.The SAP HANA database explorer can be opened from multiple locations as shown below:
Option1: Access Cockpit using BTP HDI Instances Technical (Container Runtime(RT)/DT Credentials)
- From the SAP Business Technology Platform (SAP BTP) Cockpit
- In SAP BTP cockpit, enter your global account, subaccount, and space.
- On the menu on left-side of the screen, click on Instance
- Choose your HDI instance as shown below
- Click on View Credentials
- Note down or Download Credentials.
- In your BTP Space Left-side of the screen, click on SAP HANA Cloud as shown below .
- Click on Open DaseBase Explorer Cockpit.
Note : Instead of creating HANA Cloud in your BTP Space ,If your BTP Admin has setup central HANA cloud for your sub-account (for all spaces) then ask to share central “BTP Hana Cloud Database Explorer ” URL .
- Click on Login Enter Database credentials
- If Login success then you can view user screen as below.
- Click on SQL Console.
- This open HANA SQL Cockpit & then you can choose your HDI schema as shown below.
Schema ID is your BTP Space HDI instance, choose accordingly .
- Once you access Schema then you can view tables , views , procedures .. etc
One additional tip : If you have other technical credentials ,you can switch user by right click on Schema & login with different user , enter technical user credentials ..
You can further refer tutorials How to Create Database Objects with SAP HANA Database Explorer .
Option2: Access BTP HDI Container using SAP HANA Database Explorer
If you know SAP HANA Database Explorer Cockpit & have access to BTP Space then follow below steps.
- Click on + Symbol.
- Choose HDI Container in instance Type.
- Choose HDI instance.
- You can enter Display name to visible in SAP HANA Database Explorer Cockpit.
Option3: Connect to HANA Database using SAP HANA Database Explorer
You can provide the host, port, user name, password from HDI instance of BTP Space
Note :
It is good to know about which Credentials to use ,so few notes for you.
- If you have access to BTP & HANA Cloud instance then ,the HANA Database Explorer will open in a new browser tab and automatically select the database entry for your project’s HDI container.
- Note that the credentials can be saved so they do not need to be re-entered if they are entered into the SAP HANA cockpit.
- As best practise you should avoid DBADMIN Credentials usage.Also be aware that if DBADMIN User locked ( I mean , if someone tried with wrong password ,it is not easy to Unlock /Reset Password, We need to reach to HANA Cloud ,it will take time as there is no self-service as of now to rest DBADMIN User so better to avoid Locking of DBADMIN User )
- Recommendation
It is highly recommended that you do not use DBADMIN for day-to-day activities in production environments.
Instead, use it to create database users with the minimum privilege set required for their duties (for example, user administration, system administration). Then deactivate DBADMIN. You may temporarily reactivate the DBADMIN user for emergency or bootstrapping tasks.
You can also create alternative ADMIN User ,follow official guide for HANA Database Users.
Create Users and Manage Roles and Privileges
User Management with the SAP HANA Database Administrator DBADMIN
Documentation
- SAP HANA Cloud Guide
- SAP HANA Cloud community
- SAP HANA Cloud Onboarding Guide Module 01 – Fundamentals
- Security Administration and User Management
Thank you for reading this blog post. If you find this material useful then please leave your feedback in the comments section below.
Kindly let me know if you need any further assistance in comments section below.
Also ‘Like’ ,‘Share’ , ‘Follow’ me to get new updates.