How do I create a connection to an external db with a Phonegap app?

Asked

Viewed 615 times

2

I’m entering and studying the world of Phonegap/Cordova and I want to start developing cooler and more interactive apps, but I’m finding this limitation, in most of the places I find to learn, the databases for the applications using Phonegap/Cordova are local and I would like to know if it is possible to make an application using these tools(safely) with an external database and if yes, how to do.

Obs: I have already found questions with answers here that said it was possible to make the connection with the bank with the JS, but in return, this was not safe.

2 answers

0


Directly on the client side it is not possible to connect directly to the database.

On the server side, with javascript we have Nodejs that makes this connection. Or you can even use several other languages like ASP.NET, PHP, Java, Python, Ruby (on Rails) etc.

What is used is to create a REST Webservice (easier) or Websocket (less used) for server communication with the client application.

Once having the server, the client can communicate with http or websocket to exchange data with the server and so with the database.

There are several alternatives depending on the javascript framework you will use if you will use one.

Search for AJAX Webservices and Requests.

0

Hello, a very cool option that leaves transparent for you this part of XHR and ajax and has a whole back-end at your disposal is the Firebase, a google service that can be accessed with javascript. Take a look there..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.