Loading CSV file to SAP Hana table

66 views
Skip to first unread message

Nvx Nvx

unread,
Jul 15, 2015, 7:53:17 AM7/15/15
to nod...@googlegroups.com
Hi I am very new to node.js.
I am unable to insert CSV file to Hana table.
Please provide me sample code.

Ryan Schmidt

unread,
Jul 15, 2015, 10:39:16 PM7/15/15
to nod...@googlegroups.com
Welcome to node. Can you show us the code you've written so far, and what problems you're having with it? We can help you if you're having trouble, but we're not going to "do your homework for you", so to speak.


sai kumar m

unread,
Jul 16, 2015, 8:37:15 AM7/16/15
to nod...@googlegroups.com
my code 
-----------------

var hdb    = require('hdb');
var csv = require("fast-csv");
var client = hdb.createClient({
    host     : '*********',
    port     : 30015,
    user     : '**********',
    password : '*******'
});
client.on('error', function (err) {
    console.error('Network connection error', err);
});
csv.fromPath("Sampledata.csv")
    .on("data", function(data){
       // console.log(data[0]);
        client.connect(function (err) {
    if (err) {
        return console.error('Connect error', err);
    }
    client.prepare('insert into VIDEOANALYTICS_BRISTOL.STG_IVX_VAN_TRAFFIC_BY_ZONE_PP values(?,?,?,?,?,?,?,?,?)', function(err, statement){
    if (err) {
        return console.error('Prepare error:', err);
    }
    statement.exec([data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7],data[8]], function(err, affectedRows) {
        if (err) {
            return console.error('Exec error:', err);
        }
        console.log('Array of affected rows:', affectedRows);
    });
});
});
    })
 

Nvx Nvx

unread,
Jul 17, 2015, 11:39:38 AM7/17/15
to nod...@googlegroups.com


On Thursday, July 16, 2015 at 8:09:16 AM UTC+5:30, ryandesign wrote:

On Jul 15, 2015, at 5:03 AM, Nvx Nvx wrote:

> Hi I am very new to node.js.
> I am unable to insert CSV file to Hana table.
> Please provide me sample code.

My Sample code is
Reply all
Reply to author
Forward
0 new messages