SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Connect Using the SAP HANA Node.js Interface

Create and debug a Node.js application that connects to SAP HANA using the SAP HANA client.

Overview

🎓 beginner 20 min. SAP HANA CloudBeginnerSAP HANA Cloud SAP HANA DatabaseSAP HANASAP HANA Express EditionNode Js

You will learn

  • โœ”How to install Node.js and the SAP HANA client Node.js driver
  • โœ”How to create a Node.js application that queries a SAP HANA database
  • โœ”How to use both the synchronous and asynchronous driver interfaces

Prerequisites

Prerequisites

  • You have completed the first 3 tutorials in this mission.

Steps

Intro

Node.js provides a JavaScript runtime outside of the browser and uses an asynchronous event driven programming model. For more details, see Introduction to Node.js.


Step 1 Install Node.js
โ€”

Ensure you have Node.js installed and check its version. Enter the following command:

Shell
node -v  

If Node.js is installed, the currently installed version is returned, such as v20.10.0.

If Node.js is not installed, download the long-term support (LTS) version of Node.js from Download Node.js.

If an install for Node.js is not provided on Linux, you may choose to install it via a package manager. For more details, please navigate to this link.


During the installation, there is no need to install tools for native modules.

Chocolatey
Chocolatey


The SAP HANA client provides a 32-bit and a 64-bit install, as does Node.js. The Node.js driver provided with the SAP HANA client is available for 64-bit only. For further details on supported versions, see SAP Note 3165810 - SAP HANA Client Supported Platforms.


Another option is to use a docker image that contains Node.js as shown below.

Shell
docker run -it --name=nodealpine node:alpine /bin/bash
Step 2 Install SAP HANA client for Node.js from NPM
+
Step 3 Create a synchronous Node.js application that queries SAP HANA
+
Step 4 Create a synchronous app that uses a connection pool
+
Step 5 Create an asynchronous app that uses callbacks
+
Step 6 Create an asynchronous app that uses promises
+
Step 7 Debug the application
+
Step 8 Use TypeScript
+
Step 9 Knowledge check
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 9
1. Install Node.js 2. Install SAP HANA client for Node.js from NPM 3. Create a synchronous Node.js application that queries SAP HANA 4. Create a synchronous app that uses a connection pool 5. Create an asynchronous app that uses callbacks 6. Create an asynchronous app that uses promises 7. Debug the application 8. Use TypeScript 9. Knowledge check

Learn more →