Skip to Content
0
Former Member
Aug 03, 2016 at 09:40 AM

Unable To Create/Post through Mysql Odata Service

162 Views

Hello Everyone,

I am making a SAPUI5 application where I need to use mysql database, to acheive that I created an Odata Service from :

http://scn.sap.com/community/gateway/blog/2014/02/05/odata-producer-using-apache-olingo-with-mysql-jpa-tomcat-web-server

I have two tables : Login, Session

I followed each and every step and I got the service:

When I am trying to read the data its working perfectly through the following code:

gatewayLoginLink = "proxy/http/localhost:8080/login/login.svc";

var path="/Sessions?$format=json"

var iModel = new sap.ui.model.odata.ODataModel(gatewayLoginLink, true);

iModel.read(path, null, null, true,

function(oData1,oResponse)

{

var oJSONmodel = new sap.ui.model.json.JSONModel();

oJSONmodel.setData({

modelData : oData1.results

});

alert("Successful");

},

function(oError) {

alert("Error");

});

But When I am trying to write through following code:


var value=

{

loginid:"11",

password:"1"

};

oModel.create('/Logins', value, null, function(oData,

oResponse){

alert("Success Create");

},function(){

alert("Error Create");

});

Its giving Error on console:

Kindly Help me out please.

If there is any different way to access mysql database through sapui5 app kindly tell me that too, it would be great help.

Attachments

Untitled.jpg (35.9 kB)
Untitled.jpg (357.7 kB)