on 07-03-2017 1:36 PM
Hi,
I'm trying to trigger a procedure from XSJS file but I'm always getting the error as "conn.prepareCall is not a function". Below is my simple code for XSJS file.
It seems it is having a issue with the call statement. if yes what would be the correct Call statement ?
$.response.contentType ="text/html";
//var param_date = $.request.parameters.get('pdate');
//var param_version = $.request.parameters.get('pversion');
//var param_dataset = $.request.parameters.get('pdataset');
var call = "{CALL \"FIN_FPA\".\"PR_SNAPSHOT_LOAD_DATA\()}";
//"call \"MyPackage.procedures::addUserC50\"(?, ?, ?)";
try{
var conn = $.hdb.getConnection();
var pc = conn.prepareCall(call);
pc.execute();
pc.close();
conn.comit();
conn.close();
}catch(error){
$.response.setBody("failed to trigger the procedure. <br> Error Message : " + error);
$.response.status($.net.http.INTERNAL_SERVER_ERROR);
}
Hi Guys,
I have resolved the issue and got before closing the question i want to share the solution.
I was getting connection properties as var conn =$.hdb.getConnection();
Hence in the hdb connection class we don't have method called prepareCall() so that was throwing error. So if you want to use prepareCall we need to get the connection details as var conn =$.db.getConnection();
With HDB connection we need to use the loadProcedure() to call a procedure also we can provide the arguments/parameters to the procedure.
Thanks,
Anurag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anurag,
Try using the "sap.hana.xs.libs.dbutils" library as mentioned in the below documentation link:
This will resolve your issue.
Good Luck!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sumit,
Thanks for the input.Good to know the other way around to do this as you have suggested.
I have found the solution of the issue. I was getting connection properties as var conn =$.hdb.getConnection();
Hence in the hdb connection class we don't have method called prepareCall() so that was throwing error.
with HDB connection we need to used loadProcedure() to call a procedure.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.