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.
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.
following the readme.txt in tools folder.
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.
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]
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) {
client.end();
if (err) {
return console.error('Execute error:', err);
}
console.log('Results:', rows);
});
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |