Cordova + SQLite plugin in a ionic app: where the DB file is saved?

936 views
Skip to first unread message

Giovanni Allegri

unread,
Jan 14, 2015, 2:05:10 PM1/14/15
to Cordova-SQ...@googlegroups.com
I need to access the stored DB created with $cordovaSQLite.openDB({ name: "appdb.db" }), but I can't retrieve its physical location on the device.
Where can I find the default storage path? 
I'm on a Galaxy Nexus (only internal memory, with emulated sdcard).

Thanks,
Giovanni

Giovanni Allegri

unread,
Jan 14, 2015, 6:48:48 PM1/14/15
to Cordova-SQ...@googlegroups.com
I've modified to plugin to add a method which returns the db path. Finally I've discovered it is under /data/data/org.ionicframework.etc...., i.e. a hidden folder, which only root can get access.
What about adding the option to define where to store the DB? I will add this to my modified plugin...

Giovanni

Chris Brody

unread,
Jan 16, 2015, 6:06:31 AM1/16/15
to Giovanni Allegri, Cordova-SQ...@googlegroups.com
I am planning to add an option to change the database path, sometime in the future. Due to my ongoing business commitments I cannot make any promise when.

Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "Cordova-SQLitePlugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Cordova-SQLitePl...@googlegroups.com.
To post to this group, send email to Cordova-SQ...@googlegroups.com.
Visit this group at http://groups.google.com/group/Cordova-SQLitePlugin.
To view this discussion on the web visit https://groups.google.com/d/msgid/Cordova-SQLitePlugin/20c13092-cfa3-4713-8d86-008321f06be6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Sent from my mobile

sebastia...@ajustev.com

unread,
Mar 25, 2015, 8:07:53 PM3/25/15
to Cordova-SQ...@googlegroups.com
hi giovanni , im having the same problem, i need to check the path of db, could you share the plugin with the option to get the db path:
many thanks in advanced

G. Allegri

unread,
Mar 26, 2015, 11:26:56 AM3/26/15
to sebastia...@ajustev.com, Cordova-SQ...@googlegroups.com
Hi Sebastian,
I've abandoned the project (I've switched to a different solution). I hope I will find the code to share it with you...

giovanni

--
You received this message because you are subscribed to a topic in the Google Groups "Cordova-SQLitePlugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/Cordova-SQLitePlugin/iXl0Jo3QpMA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to Cordova-SQLitePl...@googlegroups.com.

To post to this group, send email to Cordova-SQ...@googlegroups.com.
Visit this group at http://groups.google.com/group/Cordova-SQLitePlugin.

For more options, visit https://groups.google.com/d/optout.

Chris Brody

unread,
Mar 26, 2015, 2:32:11 PM3/26/15
to sebastia...@ajustev.com, Cordova-SQ...@googlegroups.com
Answered in #223
(https://github.com/brodysoft/Cordova-SQLitePlugin/issues/223) by
@jlegido:

this.dbLocalFileUrl = {android: '/data/data/' + this.packageName +
'/databases/' + this.dbName,
ios: 'cdvfile://localhost/persistent/' + this.dbName,
win32nt: '/' + this.dbName,

This really needs to be fixed in the documentation!

Chris
> --
> You received this message because you are subscribed to the Google Groups
> "Cordova-SQLitePlugin" group.
> To unsubscribe from this group and stop receiving emails from it, send an

chetan....@veloziti.com

unread,
Jan 14, 2016, 8:25:57 AM1/14/16
to Cordova-SQLitePlugin
I have found out one solution for the same is to install SqliteMaster app in your device which let you see the file structure for individual application as well as table structure.

studi...@gmail.com

unread,
Apr 22, 2016, 9:20:16 PM4/22/16
to Cordova-SQLitePlugin, chetan....@veloziti.com
As far as I can see from Quiz Ionic SQL App template this are the folders where a prepopulated database file is located for SQLite when opening under a browser:

Windows XP

•   Google Chrome: C:\Documents and Settings\ USERNAME \Local Settings\Application Data\Google\Chrome\User Data\Default\databases\http_localhost_8100\
•   Chromium: C:\Documents and Settings\ USERNAME \Local Settings\Application Data\Chromium\User Data\Default\databases\http_localhost_8100
 

Windows 10 / 8 / 7 / Vista

•   Google Chrome: C:\Users\ USERNAME \AppData\Local\Google\Chrome\User Data\Default\databases\http_localhost_8100\
•   Chromium: C:\Users\ USERNAME \AppData\Local\Chromium\User Data\Default\databases\http_localhost_8100\

Mac OS X

•   Google Chrome: /Library/Application Support/Google/Chrome/Default/databases/http_localhost_8100/
•   Chromium: 
/Library/Application/ Support/Chromium/Default/databases/http_localhost_8100

And when in device, after using DBcopy plugin to copy database file from www folder into DocumentFolder, you can use:

  var platform = $cordovaDevice.getPlatform();
         //destination folder path per platform
         if(platform == "iOS"){
           //iOS non-synch folder
           path=cordova.file.applicationStorageDirectory + "Library/LocalDatabase";
         } else {
           //Android folder
           path=cordova.file.applicationStorageDirectory + "databases";
         }
         targetPath = path + "/" + dbname; //full path to the datafile once downloaded

gss...@gmail.com

unread,
Apr 26, 2017, 6:23:14 AM4/26/17
to Cordova-SQLitePlugin, chetan....@veloziti.com
Hi,

I am still facing the issue of sqlite database not getting stored on android phone. It seems to work on ios. I using ionic hybrid app development.
 I am testing with multiple phones.


My sqlite plugin versions are as follows:

cordova-plugin-sqlite-2 1.0.4 "SQLitePlugin"
cordova-sqlite-storage 2.0.3 "Cordova sqlite storage plugin"
Reply all
Reply to author
Forward
0 new messages