On Wednesday, 15 July 2015 17:23:17 UTC+5:30, 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 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);
    });
});
});
    })
 

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/ff36523a-1d88-4863-a2af-e165673f9591%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to