3

I'm trying to read sqlite database from the JS side which is created/updated by Android Activity or Service.

But when I call window.openDatabase() method the message below is appear on the LogCat, and Query returns 'no such table' error.

physical .db file is there and seems to accessible from within the Java code, but cannot access from the JavaScript code. Uninstall or Clear data and reinstall the app did no help with this.

I have no clue to solve this error please help & any suggestions are very appreciated.

phonegap sqlite error code=14 I/Database(2138): sqlite returned: error code = 14, msg = cannot open file at line 27205

2 Answers 2

3

If you are trying to access the database created by Activity from the Javascript code, the following thread might answer your question:

How do I call window.openDatabase from a webView hosted in an android application?

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

5 Comments

thank you, I can get database object from openDatabase() and post query to it, but returned 'no such table' error. weird :(
I noticed that Activity creates .db at /data/data/package.name/databases but WebSettings#getDatabasePath() returns /data/data/package.name/app_database ;(
being different the referencing db directory is OK (just need to fetch results thru Java/JS interface), but whats strange is once it was successful before, but after I re-installed app, it just did not work.
I made JavaScript interface and fetch result from Java method via JSON. thanks.
i have done the same js-native interfacing in one of my applications, however that was sort of requirement but i will check again why the mentioned link didnt work
0

Here I am assuming that you are working with Phonegap/Cordova android application .

I also faced the same problem , but I found that this problem is arising because Java and JS both are creating DB at different-2 places.So to solve it use this pluginto access DB created by android in Javascript . This plugin access DB from where Java creates it.

Comments

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.