Skip to content Skip to sidebar Skip to footer

Ibm Worklight Sql Adapter For Real Device

If i use local database, say MySQL, it works perfect on simulator and emulator but for real device, localhost won't do, So i tried online database hosting. When using online hostin

Solution 1:

It would have been far far more helpful if you'd just provide the error log from LogCat...

When using Android, it is a good practice to not use localhost, instead to use the actual IP address. See this question: IBM Worklight - Unable to connect to database when using IP address instead of localhost

MySQL is a server like any other server; if you want to use it outside of your private local network, then you simply need to open it to incoming connections from the public Internet. This is not something a developer needs to fuss around with, that's what IT departments are for. So google and see how to open your network.

Solution 2:

This sounds as though you are trying to access a database directly from your device. Is that the case?

I would strongly recommend using Worklight Adapters here. So the pattern goes:

 App on Device ---> Adapter ---> Database

In that pattern the responsibility for getting from Device to the Adapter lies with Worklight and hence should be completely unaffected by whether it's a real device or an emulated one, and should also be independent of what particular database you are using or where it it.

The hop from Adapter to Database is something you can set up and test without even having an deployed anywhere. Just use the test environment in Eclipse to call adapter methods.

Why not go from device directly to database? In general that's a really bad security pattern, you're effectively putting data you care about in a very hackable place. Also it will not scale well to large numbers of users: connecting directly from the device means that effectively every user has their own connection, going via the adapter users share a controllable number of connections.

Solution 3:

Your problem is not with the SQL server it is with the connection between the device and the Worklight server. You need to be able to connect from the device to the Worklight server. Open a browser on the device and point it to the Worklight console and see that you can access it.

Post a Comment for "Ibm Worklight Sql Adapter For Real Device"