问题
I am trying to insert data into existing table in database from mobilefirst. the adapter is working fine and i can insert data into database from the adapter. But when it is invoked in client side it shows failure message.
function insert(){
var invocationData = {
adapter:"sqlad",
procedure:"procedure1",
parameters:[$('#empid').val(),$('#empname').val()]
};
WL.Client.invokeProcedure(invocationData,{
onSuccess :loadFeedsSuccess,
onFailure :loadFeedsFailure,
});
}
function loadFeedsSuccess() {
alert("success");
}
function loadFeedsFailure() {
alert("failure");
}
html
<body style="display: none;">
<!--application UI goes here-->
<h1>ENTER THE EMP DETAILS</h1>
EMP ID<input type="text" id=empid> <br> <br>
Emp NAME<input type="text" id=empname><br> <br>
<input type="submit" value=register onclick="insert();">
<script src="js/initOptions.js"></script>
<script src="js/main.js"></script>
<script src="js/messages.js"></script>
</body>
adap imp.js
var procedure1Statement = WL.Server.createSQLStatement("INSERT INTO testdemo(empid,empname) Values(?,?)");
function procedure1(empid,empname) {
return WL.Server.invokeSQLStatement({
preparedStatement : procedure1Statement,
parameters : [empid,empname]
});
}
回答1:
The actual failure here is this:
[ERROR ] FWLSE0335E: Authorization failed: ClientId 8v2iz67uij was not found on the server. [project simpledb] [ERROR ] FWLSE0048E: Unhandled exception caught: null com.worklight.authorization.endpoint.OauthAuthorizationException
The solution is detailed in this question: Authorization failure calling MobileFirst Adapter
To fully resolve the issue so that it will not appear again, you must update your Studio installation to the latest iFix. As an IBM customer you can download the latest iFix from the IBM Fix Central website using your customer credentials.
As a temporary fix you can attempt to clear the browser cookies, as suggested in the linked question.
来源:https://stackoverflow.com/questions/33099049/insertion-not-happening-in-ibm-mobile-first-sql-adapter