Hi there,
I created a little JavaScript application, that calculates different solutions to an optimization problem. At the end of each run I would like to store the solutions in a table on a HANA instance.
So far I tried to apply the code according to this example: How to insert data in HANA through JavaScript (with XS Engine)
My code with sample values:
var conn = $.db.getConnection();
var st = conn.prepareStatement("INSERT INTO \"SCHEMA\".\"testTable\" values(131,'E')");
st.execute();
conn.commit();
conn.close();
Standing alone in its own .xsjs file this code snippet performs perfectly well and the values are added to the table.
However, it doesn't work with parameterized insertion:
var st = conn.prepareStatement("INSERT INTO \"SCHEMA\".\"testTable\" values(?,?)");
st.setString(1,id);
st.setString(2,val1);
Do you have any ideas how I could include a parameterized insertion in the application to write e.g. the values stored in an array to the table?
I hope u can help me and many thanks in advance,
Daniel