Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Participant
In this blog I am going to discuss about the pure node js module (without xsjs support) to populate with HANA DB artifacts in HANA XSA.  Here we will populate a table from HANA HDI container.


Pre steps :

1. Create a Cloud DB instance : 

A. Log into the trial account and go inside dev space and create DB instance in cloud.


B. Click on Manage SAP HANA Cloud and it will let you go into the DB instance Window.




3. Start the database , Map Organization and space like below and copy the SQL endpoint which is required in the latter stage while creating connection to database.


4. Open the db. instance from  SQL console or HANA database explorer -

5. Create and load data into table -



2. Create a space in the business application studio with full stack : 

Using full stack we will be able to create the HTML5 web module.



Node.js Module creation steps:

1. Inside the space create a folder name "demonodejs" -

2.  Right cling on the folder and open integrated terminal.

3. Use the command -  npm init  .The command will initiate the Node.js module. It will ask several input required to build package. json file . These are given below -
#npm init


After execution of the command the package. Json file created .

Note : The start script not created . I will add it manually and the package. Json file will look like this.
"name": "plbapp",
"version": "1.0.0",
"description": "Nodejs App to connect to HANA DB",
"main": "index.js",
"scripts": {
"test": "echo The connecton successfull",
"start": "node /home/user/demonodejs/plbapp/index.js"
"repository": {
"type": "git",
"url": "git+"
"author": "",
"license": "ISC",
"bugs": {
"url": ""
"homepage": "",
"dependencies": {
"@sap/hana-client": "^2.15.19"


4. Now we need to install the API which will connect tp HANA DB i.e. @sap/hana-client
user: demonodejs $ npm install  @sap/hana-client


You can see the packages inside the project folder.


5. Create a folder with name "plbapp" (this name we give in the package. Json file) inside the project folder demonodejs and create a index.js. in this file we created db connection with the help of the @sap/hana-client api and execute select statement on table employee which we have created.

The code will be look like this -
var hana = require("@sap/hana-client");

var conn = {
serverNode: "",
encrypt: "true",
sslValidateCertificate: "false",
uid: "DBADMIN",
pwd: "**********",

var hanaConnect = hana.createConnection();

hanaConnect.connect(conn, function (err) {
hanaConnect.exec("SELECT * FROM EMPLOYEE",
function (err, result) {
if (err) throw err;


6. The execute command - npm start and the output will be available in the json format
user: demonodejs $ npm start



Hope it will help.

In the next session we will use this output in HTML5 module .
Labels in this area