SQL Adapter Invocation failure in IBM MobileFirst -


i'm trying insert data database using sql adapter in ibm mobilefirst platform, code reaches failure function...

main.js:

function insertdata(){    alert("function insertdata called");   var fname = document.forms["form1"]["fname"].value.tostring();   var lname = document.forms["form1"]["lname"].value.tostring();   var email = document.forms["form1"]["email"].value.tostring();   var pwd = document.forms["form1"]["pwd"].value.tostring();   // alert("fname"+fname);    var invocationdata = {     adapter: 'sqldemo',     procedure: 'procedure4',     parameters:[fname,lname,email,pwd]   };    var options = {     onsuccess : insertdatasuccess,     onfailure : insertdatafailed,     timeout : 30000   };   wl.client.invokeprocedure(invocationdata, options); }  function insertdatasuccess(result){   alert("success");   wl.logger.debug("retrieve success" +  json.stringify(result)); }  function insertdatafailed(result){   alert("failure");   wl.logger.debug("retrieve success" +  json.stringify(result)); } 

adapter'ssqldemo-impl.js:

var procedure4statement = wl.server.createsqlstatement("insert innovation (firstname,lastname,email,password) values(?,?,?,?)"); function procedure4(fname,lname,email,password) {   return wl.server.invokesqlstatement({       preparedstatement : procedure4statement,        parameters : [fname,lname,email,password]    }); } 

from messages.log file:

e fwlse0099e: error occurred while invoking procedure [project demoproject]sqldemo/sqlstatementfwlse0100e: parameters: [project demoproject] db2 sql error: sqlcode=-104, sqlstate=42601, sqlerrmc=from;ajax set firstname=?;.., driver=3.61.75. performed query: update ajax set firstname=? ajax id=? fwlse0101e: caused by: [project demoproject]com.ibm.db2.jcc.am.sqlsyntaxerrorexception: db2 sql error: sqlcode=-104, sqlstate=42601, sqlerrmc=from;ajax set firstname=?;.., driver=3.61.75java.lang.runtimeexception: db2 sql error: sqlcode=-104, sqlstate=42601, sqlerrmc=from;ajax set firstname=?;.., driver=3.61.75.

...

invalid data conversion: parameter instance vinod invalid requested conversion. errorcode=-4461, sqlstate=42815

and there more exceptions below it.

make sure in database scheme you're expecting strings, not limiting value length much, etc.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -