Integrate node.js with SAP HANA system

You can insert data into HANA database using node.js. You can also connect to SAP HANA database via JDBC driver.

To connect via JDBC, you need to install JDBC driver ngdbc.jar. This driver is installed as part of SAP HANA client installation. Ngdbc.jar file is available at this location −

C:\Program Files\sap\hdbclient\ on Windows platforms
/usr/sap/hdbclient/ on Linux and UNIX platforms

Next is to add ngdb.jar to the classpath and write a Java program to connect to a database and execute SQL command.


You can also add one or more failover servers by adding additional hosts.


Following is an example of connecting SAP HANA Server −

import java.sql.*;
public class jdemo {
   public static void main(String[] argv) {
      Connection connection = null;
      try {                
         connection = DriverManager.getConnection(
      } catch (SQLException e) {
         System.err.println("Connection Failed. User/Passwd Error?");
      if (connection != null) {
         try {
            System.out.println("Connection to HANA successful!");
            Statement stmt = connection.createStatement();
            ResultSet resultSet = stmt.executeQuery("Select 'hello world' from dummy");
            String hello = resultSet.getString(1);
         } catch (SQLException e) {
            System.err.println("Query failed!");

Updated on: 12-Mar-2020


Kickstart Your Career

Get certified by completing the course

Get Started