Friday, September 2, 2016

inserting record from xsjs to HANA DB


// sample to insert a record in Database  (Very basic code to insert a record)

// create a connection
var conn = $.db.getConnection();

// prepare the statement 
var stmt =  "insert into \"WORKSHOPA_00\".\"workshop.sessiona.00.data::address\" values('65','chennai','chennai','Tamil Nadu')";

// syntax for the above  stmt 
   //  "insert into <schema name >.<table> values('','','') "

// execute the statement 
conn.prepareStatement(stmt).execute();

// commit it in order to reflect the data chnages in hana DB
conn.commit(); 

// and finally close the connection
conn.close(); 


No comments:

Post a Comment