0
votes

I am getting this error:

FWLSE0101E: Caused by: [project ***]com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-313, SQLSTATE=07004, SQLERRMC=null, DRIVER=3.66.46 java.lang.RuntimeException: DB2 SQL Error: SQLCODE=-313, SQLSTATE=07004, SQLERRMC=null, DRIVER=3.66.46. Performed query: update account set regTstamp = (current timestamp) where accountId = ?

while invoking the SQLAdapter.
Here is the invoke procedure:

var AcceptTocInvokeData = {
    adapter : 'DataAdapter',
    procedure : 'updateAcceptTocDate',
    params: [accountId]
};

WL.Client.invokeProcedure(AcceptTocInvokeData, {
    onSuccess: function(resp) {
        deferred.resolve(resp);
    },
    onFailure: function(resp) {
        deferred.reject(resp);
    }
});

and the SQLAdapter code:

var prepStmt = WL.Server.createSQLStatement("update account set regTstamp = (current timestamp) where accountId = ?");

function updateAcceptTocDate(accountId) {       
    return WL.Server.invokeSQLStatement({
        preparedStatement: prepStmt,
        parameters: [accountId]
    });
}

If I call the adapter from MobileFirst Studio (Run as...), it works perfectly. Does anybody know what is going on?

2
What error are you getting in the client-side, for example what do you see in the Chrome devtools? - Idan Adar
Nearly the same errormessage: Procedure invocation error. Runtime: DB2 SQL Error: SQLCODE=-313, SQLSTATE=07004, SQLERRMC=null, DRIVER=3.66.46. Performed query: update account set regTstamp = (current timestamp) where accountId = ?. - Hugo B.

2 Answers

2
votes

If you check the DB2 manual for SQLCODE -313, you might see something like this:

The number of variables in the EXECUTE statement, the number of variables in the OPEN statement, or the number of arguments in an OPEN statement for a parameterized cursor is not equal to the number of values required.

Apparently, the parameter is not bound to the prepared statement.

1
votes

I got the solution on my own:
I wrote in the invokeData params not parameters.