M Fuad
M Fuad

Reputation: 73

SQL adapter in Worlight?

I am new to IBM Worklight,and i found a way to connect to the MySQL using the SQL adapter. the configuration as below:

            <dataSourceDefinition>
            <driverClass>com.mysql.jdbc.Driver</driverClass>
            <url>jdbc:mysql://localhost:3306/worklight_training</url>
            <user>Worklight</user>
            <password>Worklight</password> 
        </dataSourceDefinition>

Since the adapter are compile together with the app, just wondering, is it safe? is there a possibility of someone decompiling my apk or ipa to view the adapter connection thus acquire the user and password to my mysql database.

Upvotes: 1

Views: 141

Answers (2)

Leandro David
Leandro David

Reputation: 597

Adapters are Server side code andare not part of the apk or ipa files.

You can check/confirm this information in Worklight documentation. The details about adapters, under "Developing the server side of a Worklight Application" are at:

http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.dev.doc/devref/c_overview_of_ibm_worklight_adap.html

You can also check the Server Side Development of MobileFirst Platform Getting Started Modules

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/server-side-development/

(MobileFirst Platform is the new name of Worklight)

In worklight, you usually have the application (apk/ipa) communicating with a server side component (the adapters) running in a worklight server. The adapters are used to communicate with backend systems (like a mysql server). There are a few different types of adapters to communicate with different types of backends (like sql, http and SAP)

Please, let us know what documentation/guide caused you the understanding that adapters are part of the client apk/ipa. If that is really stated in any documentation, it is wrong and must be corrected.

Edit: To connect to a MySQL DB (no matter if it is a standalone MySQL or in XAMP, LAMP or whatever package) you can follow this geting started tutorial

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/server-side-development/sql-adapter-communicating-sql-database/

Also note that, if you are using MobileFirst Studio (previously Worklight Studio) downloaded for free from Developer Works you have a developer version of the WOrklight Server running inside Studio so that you can create and deploy adapters and use it during development as your server. But when you go to production you are required to purchase licenses of Worklight because you don't have the worklight server available for free. So if you have Studio, you have the server available but only for development purposes.

Upvotes: 1

Idan Adar
Idan Adar

Reputation: 44516

A hacker decompiling your .apk or .ipa file will not find the database username/password there, for the simple reason that the adapter is not compiled "together with the app" and is not part of any artifacts that you install in a device.

An adapter is a server-side entity, not client-side.
The adapter is an object stored in the memory of the running application server.

Upvotes: 3

Related Questions