Skip to Content
Author's profile photo Srdjan Boskovic

Try hanatrial using Python or nodejs

Step by step example how to connect to SAP HANA Trial instance using Python or nodejs open source client, PyHDB or node-hdb and HANA Cloud Platform Console Client.

1. Download the SDK

To connect to hanatrial instance you need the command line client, from SAP HANA Cloud Platform Tools. If not already installed within your eclipse installation, download the SDK of choice from SAP Development Tools for Eclipse repository.


Unpack, start the bash shell on Linux or OSX, or Command Prompt on Windows and go to tools subfolder of the SDK. This example is tested on Linux (Ubuntu 14.04), on Windows should work the same way.

2. If you are behind a proxy, configure the proxy in your shell

following the readme.txt in tools folder.

3. Open the tunnel to hanatrial instance

following SAP HANA Cloud documentation,  like for example:


Username, account name and HANA instance name you may check in hanatrial Cockpit



After entering the password, the tunnel is opened and the localhost proxy created, for hanatrial instance access:


The default local port is 30015 but check if different.

4. Connect from Python or nodejs Client

Use displayed parameters to connect from Python client and display table names for example:

import pyhdb

connection = pyhdb.connect(‘localhost’, 30015, ‘DEV_4C55S55VRW5Z1W3STRMBCWLE0’, ‘Gy5q95tQaGnOZbz’)

cursor = connection.cursor()

cursor.execute(‘select * from tables’)

tables = cursor.fetchall()

for table in tables:

    print table[1]

Screen Shot 2015-04-24 at 15.09.46.png

It works the same way for nodejs client, only connection parameters adapted from node-hdb Getting Started example:

var hdb    = require(‘hdb‘);

var client = hdb.createClient({

  host    : ‘localhost‘,

  port    : 30015,

  user    : ‘DEV_4C55S55VRW5Z1W3STRMBCWLE0‘,

  password : ‘Gy5q95tQaGnOZbz


client.on(‘error‘, function (err) {

  console.error(‘Network connection error‘, err);


client.connect(function (err) {

  if (err) {

    return console.error(‘Connect error‘, err);


  client.exec(‘select * from DUMMY’, function (err, rows) {


    if (err) {

      return console.error(‘Execute error:‘, err);


    console.log(‘Results:’, rows);



Screen Shot 2015-04-24 at 15.35.02.png

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks Srdjan.

      It proved to be the perfect solution to access hanatrial from python in windows.

      Author's profile photo Vignesh Jeyabalan
      Vignesh Jeyabalan

      Hi Srdjan Boskovic

      I am able to open the db tunnel by following your steps , but it doesn't provide me with a user name and password.


      Please let me known if i am missing something.

      Thanks in advance