Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova sqlite location: path to downloaded db #757

Open
mantua75 opened this issue Feb 20, 2018 · 2 comments
Open

Cordova sqlite location: path to downloaded db #757

mantua75 opened this issue Feb 20, 2018 · 2 comments

Comments

@mantua75
Copy link

Hi, my new app use "cordova-plugin-file-transfer" and "cordova-plugin-file" to download a Sqlite db from a website.

I set "cordova.file.dataDirectory" like db destination's folder.

I use "cordova-sqlite-storage" to manage this db but how can I set in "location" param to open my downloaded db?

This app will run only on Android

Code example:

var uri = encodeURI("https://.....");
var fileURL=cordova.file.dataDirectory+'/confData.db';

fileTransfer.download(uri, fileURL, function(entry) {},function(error) {});

DBConf = window.sqlitePlugin.openDatabase({name: 'confData.db', location: ????? });

Thanks

@brodycj
Copy link
Contributor

brodycj commented Mar 5, 2018

How the location parameter works is documented in README.md. Please review the existing documentation very carefully, still needs to be clarified for the sake of newcomers (storesafe/cordova-sqlite-storage-help#33).

Actual database path still needs to be documented (storesafe/cordova-sqlite-storage-help#40, #426). #426 (comment) may be helpful for Android & iOS.

@shaik-azmat
Copy link

shaik-azmat commented Sep 5, 2019

HI,
I have downloaded sqlite db file to location :cordova.file.dataDirectory+"Library/LocalDatabase" from my server, unzipped that file to same location. After that when i try to open db using

window.sqlitePlugin.openDatabase({
name :'MBZ2X8.db.zip',
key: '',
location: 2
},function (success) {
},function(err){
});

opening db is success but I am getting no such table found error while trying to access any table . same is working in android like a charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants