How to connect sqlite with an online database on Phonegap.

471 views
Skip to first unread message

Rana

unread,
May 12, 2012, 11:41:38 AM5/12/12
to phon...@googlegroups.com

Hi, 

I made a database using phonegap[cordova 1.7.0] sqlite on IOS5. But instead of using this database, I want to switch it with one that I already have on an online server.

Is there some method to do that ? And would it be possible to update the online database using the functions provided at the storage api of cordova ?

Thanks a lot.


jcesar

unread,
May 14, 2012, 2:19:42 AM5/14/12
to phonegap
You can't switch them, phonegap can only use local database, but you
can sync it with a online database, I think there are some plugins to
do this

Mohit

unread,
May 14, 2012, 5:29:55 AM5/14/12
to phonegap
hi jcesar!
I'm having trouble understanding Phonegap... have downloaded anything
yet, so am new to creating any android app at all!
How can I create an sqlite database? Can I link external text files to
the database? Like a databse of cities with some info in a text file
named as per the city name?
I'm not an expert at coding, but know little bit of html, css, C++ and
flash action script... I mean I can understand coding, but cannot
create any code from scratch, can edit it if it's simple.
Any help would be great!

Thanks.
-Mohit.

Rana

unread,
May 14, 2012, 9:26:33 AM5/14/12
to phon...@googlegroups.com
Are you sure of that? So, even if I have a database script, I can't connect it with the phonegap ?

jcesar

unread,
May 15, 2012, 2:53:07 PM5/15/12
to phonegap
With phonegap you can only use sqlite, and you create and access the
data with javascript.
There are some ways to load a sqlite dump file and work with it.
This 2 options are always with local data.

But you can't work with a server database (mysql, oracle) directly
from phonegap, to read server databases you need code on the server to
access the data and convert it to XML or JSON (or even TXT), and then
you can read it from your app with javascript and show it or store in
your local database.
I think there are plugins who take care of the data sync between the
local database and an online database
Reply all
Reply to author
Forward
0 new messages