Skip to Content
0
Jul 24, 2019 at 11:46 AM

Calling Stored Procedure from XSJS in XS Classic

188 Views

Hi,

I am trying to call the stored proc from XSJS in XS Classic. This is my code:

var conn;
try {
	conn = $.hdb.getConnection();
	
	var fn = conn.loadProcedure("GUNAWF01", "ACCESS_TEST.FD.STORED_PROCEDURES::PR_050_HTS_SQL_TRAINd");
	//var fnResult = fn(searchStrategy);
	conn.commit();
	conn.close();
	$.response.setBody("Training finished.");
	$.response.status = $.net.http.OK;
	
} catch (err) {
    $.response.contentType = "text/plain";
    $.response.setBody("Error while executing query: [" + err.message + "]");
    $.response.returnCode = 200;
}

It looks like the stored procedure is never called. I got the message "Training Finished", but I don't see any output from the stored procedure. Not sure what is missing.