Mobile - connect to database

6 views
Skip to first unread message

Alex Samoilescu

unread,
Feb 17, 2012, 8:24:18 PM2/17/12
to mobileweb...@nyu.edu
Sean,
Wanted to get your opinion/direction on something.  It  seems that the biggest hurdle for me at this point  is finding out a way to connect my mobile app to an existing SQL database - that's where my data exists at this point.  From my research so far, it seems that I will need to create a web services in order to make my data available to the outside world via XML or JASON.  After the web services are available, then I can consume data using mobile app.  

Am I approaching this the right way?  Can I access data from mobile device any other way than through a web service?  Thoughts, advice?

Alex

--
Regards,
Alex Samoilescu

T: 646.484.8415

Sean Montgomery

unread,
Feb 18, 2012, 1:17:10 PM2/18/12
to mobileweb...@nyu.edu
Hi Alex,

Generally, yes, I think you're heading in the right direction. 
You can use AJAX to POST a JSON object to your server-side PHP, which can handle all your SQL reads/writes and then return JSON data via an AJAX response.
This looks like a pretty simple tutorial - http://simpletutorials.com/?path=tutorials/javascript/simple_ajax
and another example / tutorial here - http://api.jquery.com/jQuery.post/

You could alternatively use XML to wrap up your data rather JSON objects - e.g. http://www.javascriptkit.com/dhtmltutors/ajaxgetpost3.shtml
but I think parsing JSON is really nice and easy, so I would go that route unless you come up with a reason not to.

Let me know if this is helpful.

Cheers,
Sean

Sean Montgomery

unread,
Feb 19, 2012, 11:50:36 PM2/19/12
to mobileweb...@nyu.edu
In case it helps, I found this simple example using jquery to POST JSON data to/from a php server -  http://www.devirtuoso.com/2009/07/beginners-guide-to-using-ajax-with-jquery/ 
-s

Alex Samoilescu

unread,
Feb 20, 2012, 12:33:10 AM2/20/12
to mobileweb...@nyu.edu
Thank you, this is very helpful - I think this is all coming together now.  Can't wait to implement.
Alex

Nick Santaniello

unread,
Feb 23, 2012, 3:58:38 PM2/23/12
to Mobile Web Spring 2012
Hey Alex,

I've accesed SQL databases from my mobile web apps before using some
simple PHP. There are some JQuery helpers for sending requests to php
scripts such as $.post that make the process a lot easier on the HTML
side. If you want, I'm happy to show you what I know sometime.

Nick

Martín Bravo

unread,
Mar 1, 2012, 5:51:30 PM3/1/12
to mobileweb...@nyu.edu
a good reference for what to put in your .gitignore file


then if you had already commited the project you want the files to be removed from the repo but not  from your project.

git says you can do : git rm --cached <file>

in our case (you can just copy and paste in the project folder in the terminal):

git rm --cached *.apk 
git rm --cached *.ap_ 
git rm --cached *.dex
git rm --cached *.class
git rm --cached local.properties
git rm -r --cached bin/
git rm -r --cached gen/


On Fri, Feb 17, 2012 at 8:24 PM, Alex Samoilescu <alex.sa...@gmail.com> wrote:

Ben Turner

unread,
Mar 1, 2012, 5:57:51 PM3/1/12
to mobileweb...@nyu.edu
Thanks for this.  This answered my question to the ITP list too.

Sheiva Rezvani

unread,
Mar 1, 2012, 5:58:50 PM3/1/12
to mobileweb...@nyu.edu
awesome, thanks!

2012/3/1 Martín Bravo <bravo...@gmail.com>



--
--
To avoid criticism, do nothing, say nothing, be nothing. - Elbert Hubbard

Sheiva Rezvani
c: 310-895-8777
www.sheiva.com

Reply all
Reply to author
Forward
0 new messages