sqlibm-mobilefirstworklight-adapters

Worklight, SQL-Adapter, The user specified as a definer ('mobilefirst'@'localhost') does not exist


Im new to sql and worklight. Im following SQL-Adapter tutorial from IBM Worklight, and import the sample code to worklight studio.

After deployed adapter, I choose Run as -> Call Mobilefirst Adapter.

This is my response for procedure "getAccountTransactions1":

{   "isSuccessful": true,   "resultSet": [   ]}

This is my response for procedure "getAccountTransactions2":

{   "errors": [      "Runtime: Failed to retrieve data with procedure : getAccountTransactions"   ],   "info": [   ],   "isSuccessful": false,   "warnings": [   ]}

And this is the errors console for procedure "getAccountTransactions2"

FWLSE0101E: Caused by: [project Adapters]java.sql.SQLException: The user specified as a definer ('mobilefirst'@'localhost') does not existjava.lang.RuntimeException: Failed to retrieve data with procedure : getAccountTransactions

I think I have something wrong with sql user 'mobilefirst'@'localhost', but i dont know why, cause I use root user in SQLAdapter.xml.

And how to set permission for "Worklight" sql user if I use it as the default of this sample code?

Image for error console


Solution

  • You've mentioned the user "mobilefirst", which makes it seem like you're using MobileFirst Platform Foundation 6.3 or 7.0 (previously known as "Worklight"), but for some reason you are following/using a sample from Worklight 6.0.0.0... why is that?

    You have somehow mixed something in your database...

    What ever the reason of the mess that you've done, the easiest solution for you is to simply grant all permissions to both mobilefirst@localhost user as well as Worklight@localhost.

    You then need to also make sure in your adapter's XML file that you are using that same user - either "mobilefirst" or "Worklight" (the same user from the database that you've granted all permissions for).

    For exact query to run, you can refer to Stanislovas's answer - simply replace "root" with the appropriate username.

    And don't mix old samples with new product releases...