phonegap external storage - mysql

I am using phonegap to make iphone and android apps. I need to be able to store data on a mysql database on my server as well as use my websocket server.
How can I go about doing this as the app will be running on local html and javascript files which cant run ajax/websocket requests on external servers?

So let me convert my comments into an answer.
You need a client-server architecture, where the clients will be all your end devices. The server in this case needs to be a globally reachable host somewhere (Amazon cloud, perhaps?).
Your device will send updates to the backend server that has a connection to your database, using ajax calls. These updates will be stored on the server.
All your other clients need to periodically poll the same backend server using ajax, and will get the updates sent from your primary device.

Related

Node.js Server (Mobile Client)

I am trying to make a Data Monitoring with Mobile App.
I have a mysql database and i am planning use Node.js server.
My project:
Node.js server connect to mysql db.
Mobile apps connect to node.js server and when the new data add to mysql, node.js server send to data mobile apps using restful service.
Is it possible to communicate between node.js server and firemonkey mobile client apps? (I' ll build mobile apps via firemonkey - Delphi)
The reason to use push notifications, is so that your Mobile app does not waste resources to maintain constant connection to the server awaiting for new data, whether it is a web socket or a check for new data.
Keep in mind that Push notifications code might be different for Android and iOS platforms.

Database application and remote MySql

I would like to create a desktop application that should work with data on a mySql server running on a remote machine.
So each user has a copy of the desktop app and edits data on the remote mySql server.
Now my problem is that the mySql server will not allow connections from other hosts.
Question, is this just the wrong way of creating the app. If not how do I give any host access to the MYsql server.
(I know I can open up for a specific IP but that won't work as the app could be running anywhere)
You should front your database on the server with a thin service layer, where you could do some validation / processing on the data, perform authentication, etc. Your client apps would then expose those methods in your service layer as web services, to which your client apps would communicate using either SOAP/XML, REST/JSON, etc. In general, it is a bad idea to expose your database directly if your application is within a LAN, and a terrible one to expose it on the internet.

How to write to a remote DB from an android app

We have an android app that currently sends data to a php script which writes to a mysql DB on the same server. We are thinking of using a scalable DB server e.g. FathomDB (which is just based on amazon RDS & rackspace) so that we can handle load increases easily.
The question is how does our android app write to these remote DBs? Do they have some kind of rest API, or allow you to have a php script similar to the one we have in place at the moment?
I'd say most of services like these have a connector running on the web, like the one you are using. But some of the services you mention (for example amazon rds) have a native mysql connection. So you can connect using mysql to the server and run queries like you currently do in php. You can use ACL to ensure security in your application :)

how to connect mysql server on external server in j2me application

I have a hosting account at godaddy ruinning Linux. Is has MySQL. I am creating a J2ME application that runs on android and I was wondering if there is any simpler way to connect from j2me application to my MySQL server?
Is it required to install anything at my server? which I cannot do because of the shared account. Any way to just open the connection, update some data in the MySQL from j2me application?
It is quite simple. You just need to do HTTP application/x-url-form-encoded request on the midlet and set request property to HTTP.POST. Then stream form data as bytes. Receive those post variable using a server side language (i used PHP) like $_POST['var'] and in that server script write MySQL query like insert into .. VALUES.. etc.
I don't know if any DB drivers exist for J2ME. If you can't find them just make layer on the server and implement your own protocol for retrieving data via http or sockets

Hosting a Silverlight database application that works with MySQL

I have a basic hosting package that gives me access to create a MySQL database. I can of course host silverlight applications on any site. But how can I work with a database from within Silverlight? I cannot run any service on my hosting provider, they only allow php or perl scripts.
You can use the C# webclient to make HTTP calls to a PHP page hosted on the server. The PHP page can proxy queries/results between the silverlight client and the mysql database.
remember, just because it's not a SOAP/WCF "service" does not mean that it's not a web service. Look into PHP based REST solutions for some nice alternatives that can easily be invoked via silverlight:
http://www.bing.com/search?q=PHP+REST
Edit: As #Spencer Ruport correctly points out in the comments, you of course have to be wary of the fact that the web service will be exposed to the public, and anyone can easily sniff the http traffic between your silverlight application and the server. This enable them to call your service directly so be sure to think about authentication and what it means in the context of your app/data
You can use the WebClient class in silverlight to communicate to a php service. Here is the first google result I found: link