0

I have just started using phonegap, and my application demands an use of a database for storage. Now, i have read all the documentation for phone-gap's storage, but nowhere is it given that one can access an already present database. My question is that can one use an already created database through phonegap? if so then how to do it? where and how to include the database file and how to retrieve values?

asked Oct 10, 2011 at 6:17

1 Answer 1

1

Not easily.

There are some seemingly hackish ways to do it, but I have nto tested them. I will post links below.

I am in the same boat. Here is what I am planning (I have done this before with AIR applications for different reasons, I will be doing it with my next PhoneGap app).

Using a tool like SQLite Studio I will take the pre-existing DB and export it (data and all) to a create script. Then I will use that create script to create and load the DB and tables the first time the app runs. Unless you are dealign with a huge amount of data I think this would work in most cases.

References for the hacky solutions:

http://groups.google.com/group/phonegap/browse_thread/thread/ca6c85f7d6c3976c/1195990551444915 http://groups.google.com/group/phonegap/browse_thread/thread/5e57a728dc66a2a1

answered Oct 11, 2011 at 1:44
Sign up to request clarification or add additional context in comments.

2 Comments

i saw that article, and what you are planning to do seems that it could make it work. The deal is, that my PM wants me to create an app that'll work on IOS and ANDROID, so the way that is used in the link you mentioned explicitly uses objective-C and also the path's that the databases are going to be stored in their respective emulators is gonna be different. So i guess it won't work on ANDROID, or else what i'll have to do is that i'll have to find a similar workaround for android and write a script for it as well.
Your way of doing it seems more sensible, thanks for sharing it :)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.