1

I have copied the Android project from below mentioned location:

http://groups.google.com/group/phonegap/browse_thread/thread/07cf9f48e3cd0663

I have created a SQLite database on my system, now I want to use the same database in my project. But, I want to connect to the database using Javascript (not using Java). Can any one of you give me some tips or any reference to achieve this task.

1 Answer 1

1

If you are referring to javascript running in your browser you won't be able to do that.

A sqlite database is a file on your file system. Javascript which runs in browsers has no, or very limited, access to your file system.

However, modern browsers (and probably most modern mobile browsers as well) do allow you access to the IndexedDB storage API which is a SQL database running on the client and available to your website.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the response Ikanobori, I think the way I asked the question was wrong, what I actually meant was, if you look at the reference code (URL I have mentioned), you can see a piece of code like :
var db; var shortName = 'contactdb.db'; var version = '1.0'; var displayName = 'Contact Info'; var maxSize = 65535; And some where down the line you will also see : db = openDatabase(shortName, version, displayName,maxSize); I am not able to connect to my existing database using the above mentioned logic. I have put my database file "contactdb.db" under assets directory. After doing that I don't know what else I have to do. I don't know where am I going wrong.
@Vadi: i have a similar situation (stackoverflow.com/questions/13014163/…) - aka do a query from javascript to the db from /data/data/databases/. Have you found a solution ?

Your Answer

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.