Skip to Content
0
Former Member
Jun 16, 2016 at 11:24 AM

How to call a Stored Procedure via Node.JS

2965 Views

Hi,

I'm receiving errors when I want to call a Procedure via Node.JS:

app.route("/add/?")

.post(function(req, res) {

var data = req.body,

client = req.db

;

client.prepare("call my.namespace.procedures.subfolder::procName(?,?)",

function(err, stmt) {

if (err) {

res.json({status: 400, message: "ERR", data: err});

} else {

stmt.exec({

a: "test A"

b: "test B"

}, function(err, param, dummy, result) {

if (err) {

res.json({status: 401, message: "ERR", data: err});

} else {

var returnData;

returnData.param = param;

returnData.dummy = dummy;

returnData.result = result;

res.json({status: 200, message: "OK", data: returnData});

}

});

}

});

});

The Error Message:

sql syntax error: database name not allowed in single-container mode: line 1 col 6 (at pos 6)

If I switch the call-Statement to:

call procName(?,?)


It returns the Error:

invalid name of function or procedure: PROCNAME: line 1 col 6 (at pos 5)



What am I doing wrong? The Name and Namespace definitively exists.